Scale plot problem !!

Hey every1,
I am working on a small set of data to learn how to do it in my actual work !! I created two plots and the second plots I replaced the content of the plot with the content of the first plot and left the first 3 entries out I made it NaN, so the point is now my two plots are actual identical apart from my second plot b is shifted by 3 where I made it NaN.. I want to put both plot on the same graph and scale by some amount so I will be able to see the both the same apart from one is shifted.. I know I need hold on in the plot to plot them both together but I am not sure how to scale it so I will be able to see it??? How can you scale a plot by some amount to bring down a bit ???
Thanks in advance,

 Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 27 Jul. 2011

1 Stimme

axis([Xmin Xmax Ymin Ymax]);

11 Kommentare

Paulo Silva
Paulo Silva am 27 Jul. 2011
there's also the functions xlim and ylim
Fangjun Jiang
Fangjun Jiang am 27 Jul. 2011
@Paulo, is there any subtle difference between axis() and xlim(), ylim()?
Susan
Susan am 27 Jul. 2011
I tried it its doing something but the whole plot went wrong but I think I have another problem, I have my (x,y) and the other plot (f,z) as I explained I copied the content of the second plot(f,z) to the first (x,y) and left the first 3 so if you know what I mean they have the same exact pair of values apart from the first 3 which i explained what i did.. because in Matlab worksapce I had x,y,f,z all variables hold 1x100 I concatenated (x,y) to one array a= (x,y) and same for b = (f,z) so I can do the coping values as explained above I wanted to get the pair of value but the problem is when I do plot(a) or even plot(b) separately it totally do something else it produce wrong graph.. Is in it plot(a) should be equivalent to plot(a,b)? I just had to concatenated them for the reason explains but it produce wrong plot???? because of this problem now i can see the scale?
Susan
Susan am 27 Jul. 2011
Just to make it easier the plot starts the coping values part
a(1,4) = b(1,1) then a(1,5)=b(1,2) then a(1,6)=b(1,3) etc.. a(1,1) to a(1,3) are NaN
Paulo Silva
Paulo Silva am 27 Jul. 2011
Fangjun, when used to set the limits they are basically the same with one obvious difference, with xlim you can change the x limits without touching on the y limits, also the xlim can be used to retrieve the x limits of the current axes, same goes for ylim and zlim.
Paulo Silva
Paulo Silva am 27 Jul. 2011
Susan I can't understand what you are trying to do, sorry about that.
plot(a)
when a is a vector it plots the amplitude of a in the y part of the axes and the index in the x part of the axes, example a=[1 10 20]
plot(a) draws a line between the points with coordinates
x1=1;y1=1;x2=2;y2=10;x3=3;y2=20
plot(a,b) when both are vectors draws a line between each pair of indexes
x1=a(1);y1=b(1);...xn=a(n);yn=b(n);
Susan
Susan am 27 Jul. 2011
I am trying to plot two simple signals and then scale one down a bit so I will be able to see the both the same but one is shifted a bit.. My plot (a,b) and plot(f,z) works both perfectly fine but to do what I want I need to get the pair of value f,z together and find their actual value at each point then copy it to the pair x,y.. In matlab workspace x, y are both separate vector size 1x100 so to get the values and copy it to the other one and create identical plot with same exact values but second one is shifted by 3 I thought I should concatenate (a,b)and (f,z) so I can get the values and copy it to the other one. I did all that but now I want to see the result of what I was working on and thought since plot(x,y) works and all I did is concatenate them together plot(a) should be equivalent same for b so I can scale it etc.. Does that make sense now?.. Is my idea of achieving this wrong?
Fangjun Jiang
Fangjun Jiang am 27 Jul. 2011
@Susan, I recommend you going through the MATLAB help document "Getting Started" section to get yourself familiar with the basic MATLAB skills. Your previous question indicates you need those basic knowledge. I can't imaging it took 15 comments to figure out the "for k=1:100" syntax. You could just read the text from "help for". I can't understand your comment above. It is hard for me to breath too when I try to read it.
Susan
Susan am 27 Jul. 2011
Yeah, will try and read about it more and perhaps if I am too stuck ask more clear questions!! Matlab is too complicated !
Paulo Silva
Paulo Silva am 27 Jul. 2011
No Susan it isn't complicated, the problem is that too many users don't start by reading the basic documentation (me included) and often have to do something hard without the proper basis, MATLAB got the best documentation of any program you can get, all functions are documented and include examples.
Teachers should teach first how to use MATLAB basic functions and only after it ask students to use it for more difficult assignments.
Susan
Susan am 27 Jul. 2011
In my case was not taught Matlab at uni at all, we just learnt Java but was asked to use it for my actual project and trying to understand the pieces now so I can easily apply the whole methodology to the project hopefully but I do read about it but still need to read more but Thanks guys for your helps and advice :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by