i got an error when i run this code ? Error using plot

R=2;
meo=5;
ru=0:1:30*1;
syms k
Pout_k1=((2^(2*R)-1)^k).*symprod(1./(ru*5),k,1,1);
Pout_k2=((2^(2*R)-1)^k).*symprod(1./(ru*5),k,1,2);
Pout_k5=((2^(2*R)-1)^k).*symprod(1./(ru*5),k,1,5);
plot(ru,Pout_k1,ru,Pout_k2,ru,Pout_k5)

댓글 수: 6

What is the value of 'k' in ((2^(2*R)-1)^k) on the line
((2^(2*R)-1)^k).*symprod(1./(ru*5),k,1,1);
k has 3 value each Pout has determain value
Pout_k1 ..... k=1
Pout_k2 ..... k=2
Pout_k5 ..... k=5
Then what are you trying to do here: symprod(1./(ru*5),k,1,1)? Can you attach the image of the equations in mathematical form?
product notation fuction {pi}
Ameer Hamza
Ameer Hamza 2020년 5월 3일
편집: Ameer Hamza 2020년 5월 3일
Yes, that is obvious from symprod. But what are its limits? and what is its index variable? You can attach the image in the comment.
the limit is i from 1 to k
i want to plot this function for k=1 ,k=2 ,k=5
note : gama is variable eqal ru*5
R=2

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

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 5월 3일
편집: Ameer Hamza 2020년 5월 3일
Try this code, without symbolic variables.
R=2;
meo=5;
ru=1:30;
Pout = @(k) ((2^(2*R)-1)^k).*prod(1./(ru(1:k)*5));
Pout_k1 = Pout(1);
Pout_k2 = Pout(2);
Pout_k3 = Pout(5);

댓글 수: 1

sorry, but this code give me 3 result
i need 31 result for each Pout , to can plot ru with Pout
for example :
for k=1
ru=1 ----- Pout=0.004
ru=2 ----- Pout= 0.00004
... etc
and the same thing for k=2 and k=5

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

카테고리

태그

질문:

2020년 5월 3일

댓글:

2020년 5월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by