Creating a plot where my x and y values are defines by equations of another variable

40 visualizzazioni (ultimi 30 giorni)
Hopefully a simple enough problem to solve, and possibly just something obvious which slipped my mind. I have a pair of equations and want to plot their outputs such that equation 1 gives my x values and equation 2 gives my y values. Both have the same number of points, as both take in the same variable to generate their values, so there shouldn't be any discrepency there.
Thank you!

Risposte (1)

the cyclist
the cyclist il 2 Dic 2021
Modificato: the cyclist il 2 Dic 2021
Here is a simple example.
z = 1:10;
x = 2.*z;
y = 3.*z;
figure
plot(x,y)
xlabel('x')
ylabel('y')
  1 Commento
Evan Thexton
Evan Thexton il 2 Dic 2021
Thank you!
I had done this initially and it spat out a very weird result for the equations it should have been taking in, but it turns out that something had gone horribly wrong elsewhere in my code, which your confirmation that I hadn't just gotten confused helped me find.
Once again, thank you very much

Accedi per commentare.

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by