MATLAB: Do I get this error? “indices must either be real positive integers or logicals.”

faqplotpositive integers or logicals

hi, why do I get this error ?
Subscript indices must either be real positive integers or logicals.
Error in sev (line 27)
N(g) = (q*b-a*d)./(e*(q^2)+g.*2*a)
here's my code..
syms q
a=2; b=2; d=0.5; e=0.9 ; q=0.4;
g=1:0.1:10
N(g) = (q*b-a*d)./(e*(q^2)+g.*2*a)
i(g)=(b-e*q*N)/a
m=N(g)
n=i(g)
figure(1)
plot (g,m,'b')
hold on
plot (g, n,'red')

Best Answer

You need not to use syms. there is no requirement of syms.
You need not to use indesing N(g), this is not reuqired also this is not valid.
a=2; b=2; d=0.5; e=0.9 ; q=0.4;
g=1:0.1:10
N = (q*b-a*d)./(e*(q^2)+g.*2*a)
i=(b-e*q*N)/a
m=N
n=i
figure(1)
plot (g,m,'b')
hold on
plot (g, n,'r')