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

3 views (last 30 days)
Evan Thexton
Evan Thexton on 2 Dec 2021
Commented: Evan Thexton on 2 Dec 2021
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!

Answers (1)

the cyclist
the cyclist on 2 Dec 2021
Edited: the cyclist on 2 Dec 2021
Here is a simple example.
z = 1:10;
x = 2.*z;
y = 3.*z;
figure
plot(x,y)
xlabel('x')
ylabel('y')
  1 Comment
Evan Thexton
Evan Thexton on 2 Dec 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

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by