MATLAB Answers

How to plot the curve?

33 views (last 30 days)
Hang Vu
Hang Vu on 8 Aug 2019
Commented: Adam on 9 Aug 2019
I have:
k=2, 2.1, 2.2, 2.3, …, 4.9, 5.0
How to plot R like this: Thank you!


Sign in to comment.

Accepted Answer

Adam on 8 Aug 2019
Edited: Adam on 8 Aug 2019
R = B ./ ( 1 + k'/2 );
figure; plot( R )
R = bsxfun( @rdivide, B, ( 1 + k'/2 ) );
for earlier versions of Matlab that don't support implicit expansion


Hang Vu
Hang Vu on 9 Aug 2019
Thank you^^. But can you help the x-axis is k and Y is R?
Y is correct but X, k runs from 2:5 only, but in the graph, it is displayed 31 times of k
Adam on 9 Aug 2019
plot( k, R )
doc plot
gives details of different ways to parameterise plots.
If you just do
plot( R )
then it just uses indices along the x axis (i,e. 1 to 31 in your case). If you give it both an x and a y then it will plot both.

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by