Info

This question is closed. Reopen it to edit or answer.

Why are these plots different?

1 view (last 30 days)
Zachary Duff
Zachary Duff on 1 Jun 2018
Closed: MATLAB Answer Bot on 20 Aug 2021
I understand why the xlabel is different, but I don't understand why the image is different, while structurally appearing the same. I'm using a uniform time step for my algorithm (h = 0.01). t,z are both 22401x1 doubles. plot(z) leads to the first image, plot(t,z) leads to the second.

Answers (1)

Jan
Jan on 1 Jun 2018
The diagrams are different, because the scaling differs. This is exactly what is expected, when you define the x component of the data or omit this information. Therefore it is not clear, what your question is. You draw two different things, then you can expected, that they look different. To get the same output, you can equalize the scaling and limits:
subplot(1,2,1);
plot(z)
axis tight
subplot(1,2,2);
plot(t,z)
axis tight
  1 Comment
Zachary Duff
Zachary Duff on 7 Jun 2018
No, this wasn't the case, it happened because of a rounding error in my stepsize variable. The output data in the lower plot was misaligned with its input variable.

This question is closed.

Tags

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!