为什么我的程序得不到结果呢?
c=0.1442;
alfa=0.1;
w=0:0.1:2.5;
H=w.^2;
for w=0:0.1:2.5;
A=solve('((2*c*w)^2+(1-w^2+alfa*(3/4)*x)^2)*x=H^2');%解方程
y=A(3,1);%得到三个解,取实数解
plot(w,y)
hold on
end
该了一下,还是报错
c=0.1442;
alfa=0.1;
w=0:0.1:2.5;
for j=1:26;
H(j)=(w(j))^2;
strEqu=['((2*c*w)^2+(1-w^2+alfa*(3/4)*x)^2)*x=(H)^2'];%解方程
x(j)=solve(strEqu);
y(j)=x(j)(3,1);%得到三个解,取实数解
j=j+1;
plot(w,y(j))
hold on
end
??? Error: () Indexing must appear last in an index expression.
改了一下,把运算过程不变的常数直接代到方程中,还是不行
clear
w=0:0.1:2.5;
for j=1:26;
H(j)=w(j)^2;
strEqu=['(2*0.1442)^2*',num2str(w^2),'+(1-',num2str(w^2),'+(3/4)*0.1*x)^2*x-H^2'];%解方程
x(j)=solve(strEqu);
y(j)=isreal(x(j));%取实数解
j=j+1;
ww=double(w);
yy=double(y(j))
plot(ww,yy)
hold on
end