I am trying to plot a graph with fixed xaxis

I have 2 vectors:
w1=[85 89.25 93.5 97.75 102 106.25 110.5 114.75 119 123.25 127.5 131.75 136 140.25 144.5 148.75 153 157.25 161.5 165.75 136 119 102 85]
and
w2=[1.0126 1.0106 1.0085 1.0065 1.0044 0.9974 0.9903 0.9831 0.9844 0.9823 0.9802 0.978 0.9758 0.9736 0.9714 0.9762 0.9741 0.9719 0.9698 0.9782 0.9913 0.9979 1.0044 1.0126]
when i plot(w1,w2). i get a rounded plot and x axis ranges from 80 to 160 i am trying to fix the xaxis to plot each y value for corresponding x and make the xaxis not be a min to max axis.
I tried plot(w1,w2);axis([w1]) but got an error
??? Error using ==> axis>LocSetLimits at 234 Vector must have 4, 6, or 8 elements.
Error in ==> axis at 94 LocSetLimits(ax(j),cur_arg);
Can someone help me in plotting

Answers (1)

Well what's x and what's y? Is w1 x and w2 y? Or are they both y's and the x's are simply the index number?
Are you aware that you can use xlim() to set the min and max of the x axis?
xlim([0 500]); % Or whatever values you want.

Products

Tags

Asked:

on 20 Jul 2012

Community Treasure Hunt

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

Start Hunting!