r (y ) =(1-x^2)/(1-x*cos(y) where y= 0 to 2pi and x=(0,0.1,0.5,0.9)

댓글 수: 1

Rik
Rik 2018년 10월 12일
Should r be a vector for a given value of x?
And what have you tried so far yourself?

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

 채택된 답변

madhan ravi
madhan ravi 2018년 10월 12일
편집: madhan ravi 2018년 10월 12일

0 개 추천

x=[0,0.1,0.5,0.9]
y=linspace(0,2*pi,numel(x))
r=(1-x.^2)./(1-x.*cos(y))
plot(y,r,'-*b')

댓글 수: 2

Eylül Erol
Eylül Erol 2018년 10월 13일
thanks
madhan ravi
madhan ravi 2018년 10월 13일
편집: madhan ravi 2018년 10월 13일
make sure to accept the answer if it worked

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

추가 답변 (1개)

Stephan
Stephan 2018년 10월 12일

0 개 추천

Hi,
y= linspace(0,2*pi);
x=[0, 0.1, 0.5, 0.9];
[a,b] = meshgrid(x,y);
r = (1-a.^2)./(1-a.*cos(b));
contourf(x,y,r)

댓글 수: 3

Eylül Erol
Eylül Erol 2018년 10월 12일
why do ı have to mesh grid function and change the variables x,y to a,b? I just want to write this equation and plot of r and y graph. How can ı do that?
Rik
Rik 2018년 10월 12일
Because r depends on the value of x and y. You can either have a single value for each combination of x and y, or you will have a vector of values as the output for any y. The meshgrid function can be used to generate a grid with all combinations of values.
Note that the call to linspace generates a vector of 100 values. You can change this by adding a third input with your desired number of inputs.
Stephan
Stephan 2018년 10월 12일
Thanks Rik

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

카테고리

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

질문:

2018년 10월 12일

편집:

2018년 10월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by