how to scale two plots

I am having a very common question; but still I am helpless and found no solution for it. I am having two plots. I want to scale one plot with respect to other. On x-axis; I have scaling from 1 to 60 while on y-axis; from -100 to 500. For the second plot the x-axis has range from 0 to 9000 while y-axis has same range -100 to 500. If I scale the x-axis of second plot with respect to first one only first 60 values are shown while remaining are discarded. If I scale the first plot with respect to second one then nothing is visible only a very small line is seen on the plot. The piece of code is:
figure
axis([0 9000 -100 500])
hold on
plot(value)

 Accepted Answer

plotxx() from the File Exchange, perhaps.
But do the two ranges, 0-60 and 0-9000, represent the same range of values?
You are using the one-argument form of plot(). Do you have a list of x for each of the two cases? If so then,
plot(timelist1, valuelist1, timelist1, valuelist2)

7 Comments

Beenish Mazhar
Beenish Mazhar on 25 Mar 2013
Edited: Beenish Mazhar on 25 Mar 2013
Sir the range of values are different. kindly can you be more explicit.Sir actually I am having a block in simulink namely simout. I am plotting the values of simout in Matlab. For first plot simout has 60 values while for second plot it has 9000 values. simout contain just a column vector. Both the plots converge to same value 400.
If they do not represent the same range of x, then it does not sound like it is reasonable to plot both of them on the same graph.
A case in which it would make sense to plot them both on the same graph, would be (for example) if the 0-60 represented "minutes", but the 0-9000 was something also being simulated for 60 minutes but which was measured every 4 seconds, so that 15 entries on the wider plot corresponded to the same time interval as 1 entry on the narrower plot.
Beenish Mazhar
Beenish Mazhar on 26 Mar 2013
Edited: Beenish Mazhar on 26 Mar 2013
Sir simout just give me values it has no units. These are actually 60 and 9000 numbers and corresponding to each number I get a value.Both the plots are simulated for 60 seconds but the first plot converges after 60 values while second plot converges after 9000 values. Against 60 seconds; plot1 gave me 60 values while plot2 9000 values. Now is it possible?
Does half way through the first series correspond to 30 seconds, and half way through the second series correspond to 30 seconds? Or is it just that it takes that many steps to converge and there is no fixed relationship between iteration number and time?
If there is no fixed relationship between iteration number and time, then there is no meaning to plotting the two plots on the same graph.
K sir. In other words in order to justify; we can say that the first plot is efficient one as it converges by utilizing less values as compared to second plot.While the second plot converges after 9000 values. So both plots can't be shown on same scale rather there is no meaning to plot them on same scale. Reply me with yes or no..Thank you for guidance and time.. :)
You cannot judge efficiency just by iterations, if what is being iterated is not the same thing, or if the answers are not to the same tolerance.
Guessing from the plots, it appears to me that the one that converges after 60 values is taking a coarser step size or using a steeper descent approach on something like an ODE, which is fine when it works, but risks missing local extrema that could possibly be important.
Sir you have guessed the right thing; the ODE's for both plots are different. Actually in order to achieve the desired response ODE's were changed because desired response was not achieved by using the same ODE for both plots.Sir would this matter? One thing more sir; when we change ODE'S actually we are changing the step sizes?

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products

Tags

Community Treasure Hunt

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

Start Hunting!