I have:
k=2, 2.1, 2.2, 2.3, …, 4.9, 5.0
B=[0.2,0.4,0.6,0.8,1];
R=B/(1+k/2)
How to plot R like this: Thank you!
vd.PNG

 채택된 답변

Adam
Adam 2019년 8월 8일
편집: Adam 2019년 8월 8일

0 개 추천

R = B ./ ( 1 + k'/2 );
figure; plot( R )
or
R = bsxfun( @rdivide, B, ( 1 + k'/2 ) );
for earlier versions of Matlab that don't support implicit expansion

댓글 수: 2

Hang Vu
Hang Vu 2019년 8월 9일
편집: Hang Vu 2019년 8월 9일
Thank you^^. But can you help the x-axis is k and Y is R?
vd.PNG
Y is correct but X, k runs from 2:5 only, but in the graph, it is displayed 31 times of k
Adam
Adam 2019년 8월 9일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

질문:

2019년 8월 8일

댓글:

2019년 8월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by