matlab提示错误
y=[0:0.02:50];c1=[0:0.02:1];a1=1.73205081*120*(1.73205081/2*120+y);a2=2*(0.25*120*120...
y=[0:0.02:50];
c1=[0:0.02:1];
a1=1.73205081*120*(1.73205081/2*120+y);
a2=2*(0.25*120*120+(1.73205081*120+y)*(1.73205081*120+y));
a3=1.73205081*120*(y-1.73205081/2*120);
a4=2(0.25*120*120+(y-1.73205081*120)*(y-1.73205081*120));
c=a1/a2*c1-a3/a4*c1;
plot(y,c1,c)
grid on
Error using *
Inner matrix dimensions must agree. 展开
c1=[0:0.02:1];
a1=1.73205081*120*(1.73205081/2*120+y);
a2=2*(0.25*120*120+(1.73205081*120+y)*(1.73205081*120+y));
a3=1.73205081*120*(y-1.73205081/2*120);
a4=2(0.25*120*120+(y-1.73205081*120)*(y-1.73205081*120));
c=a1/a2*c1-a3/a4*c1;
plot(y,c1,c)
grid on
Error using *
Inner matrix dimensions must agree. 展开
2个回答
展开全部
1、矩阵对应元素相乘应该用点乘.*
2、y和c1维度应该一致,否则无法将对应元素相乘
3、plot函数用错了
y=[0:0.02:50];
c1=linspace(0,1,length(y)); % c1维度与y一致
a1=1.73205081*120*(1.73205081/2*120+y);
a2=2*(0.25*120*120+(1.73205081*120+y).*(1.73205081*120+y)); % 原来有错,另外后两项是平方,可以直接写成.^2
a3=1.73205081*120*(y-1.73205081/2*120);
a4=2*(0.25*120*120+(y-1.73205081*120).*(y-1.73205081*120)); % 同上
c=a1./a2.*c1-a3./a4.*c1; % 同上
plot(y,c1,y,c) % 原来plot函数参数不对
grid on
追问
这个函数是c=F(y,c1),要怎么画啊?谢谢了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询