index must b positive?plz help
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Walter Roberson
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu FSK finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!