index must b positive?plz help
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Walter Roberson
le 22 Août 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 commentaires
Voir également
Catégories
En savoir plus sur FSK dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!