index must b positive?plz help
3 views (last 30 days)
Show older comments
clc;clear all;
g_db=[0:1:10];
g=10.^(g_db/10);
alpha=2;
c=1;
M=2;
syms y
r=0;
for j=2:M
p=((-1)^j)*(factorial(M)/factorial(j)*factorial(M-j))*exp(-(g.*y(1-(1/j))));
r=r+p;
t=r*(1/M)
end
x=((y.^(alpha-1)).*exp(-y./c))/((gamma(alpha))*(c^alpha));
z=t*x;
semilogy(g_db,z);
hold on
0 Comments
Answers (1)
Walter Roberson
on 22 Aug 2015
You have the expression
p=((-1)^j)*(factorial(M)/factorial(j)*factorial(M-j))*exp(-(g.*y(1-(1/j))));
The y(1-(1/j)) part of that says to index the variable y at index (1-(1/j)) . As all of your j are at least 2, 1/j is less than 1 so 1-1/j is not a positive integer.
Perhaps you wanted to code multiplication instead of indexing. y*(1-(1/j))
0 Comments
See Also
Categories
Find more on FSK in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!