开发者

plotting graph in MATLAB

I have this points here

x-axis : 0.958 1.043 1开发者_StackOverflow中文版.907 0.780 0.579 0.003 0.001 0.014 0.007 0.004

y-axis : 0.003 0.001 0.003 0.002 0.001 0.105 1.748 1.839 1.021 0.214

a vector V1 = [-0.425, 0.977]

How can i plot all these on 1 graph?

With scales:

x-axis: 10^-3 until 10^1

y-axis: 10^-3 until 10^1

Thanks


It sounds like you want to do a log-log plot. You could do this:

>> x=[0.958 1.043 1.907 0.780 0.579 0.003 0.001 0.014 0.007 0.004];
>> y=[0.003 0.001 0.003 0.002 0.001 0.105 1.748 1.839 1.021 0.214];
>> loglog(x,y, '.');

Which gives this:

plotting graph in MATLAB

If you want to also plot the vector you can't plot in log-space (at least on the x-axis) because of the negative x value. Plotting in normal space can be done by:

>> x=[0.958 1.043 1.907 0.780 0.579 0.003 0.001 0.014 0.007 0.004];
>> y=[0.003 0.001 0.003 0.002 0.001 0.105 1.748 1.839 1.021 0.214];
>> figure;
>> plot(x, y, '.');
>> hold on;
>> plot([0 -.425], [0 .977]);

The results aren't as pretty:

plotting graph in MATLAB

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜