在matlab中,我输入这个语句h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb)),系统告诉我必须是标量或者是方阵在matlab中,我输入这个语句h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb,系统告诉我什么必须是标量或者是方阵才行
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/28 01:52:34
![在matlab中,我输入这个语句h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb)),系统告诉我必须是标量或者是方阵在matlab中,我输入这个语句h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb,系统告诉我什么必须是标量或者是方阵才行](/uploads/image/z/12614389-61-9.jpg?t=%E5%9C%A8matlab%E4%B8%AD%2C%E6%88%91%E8%BE%93%E5%85%A5%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5h%3Dsqrt%28%28xd-xb%29%2A%28xd-xb%29%2B+%28yd-yb%29%2A%28yd-yb%29%29%2C%E7%B3%BB%E7%BB%9F%E5%91%8A%E8%AF%89%E6%88%91%E5%BF%85%E9%A1%BB%E6%98%AF%E6%A0%87%E9%87%8F%E6%88%96%E8%80%85%E6%98%AF%E6%96%B9%E9%98%B5%E5%9C%A8matlab%E4%B8%AD%2C%E6%88%91%E8%BE%93%E5%85%A5%E8%BF%99%E4%B8%AA%E8%AF%AD%E5%8F%A5h%3Dsqrt%28%28xd-xb%29%2A%28xd-xb%29%2B+%28yd-yb%29%2A%28yd-yb%2C%E7%B3%BB%E7%BB%9F%E5%91%8A%E8%AF%89%E6%88%91%E4%BB%80%E4%B9%88%E5%BF%85%E9%A1%BB%E6%98%AF%E6%A0%87%E9%87%8F%E6%88%96%E8%80%85%E6%98%AF%E6%96%B9%E9%98%B5%E6%89%8D%E8%A1%8C)
在matlab中,我输入这个语句h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb)),系统告诉我必须是标量或者是方阵在matlab中,我输入这个语句h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb,系统告诉我什么必须是标量或者是方阵才行
在matlab中,我输入这个语句h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb)),系统告诉我必须是标量或者是方阵
在matlab中,我输入这个语句h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb,系统告诉我什么必须是标量或者是方阵才行,谁能给我解释一下怎么办,
原程序如下:
clear;
clc;
xa=0;ya=0;
l1=100;
fil1=0:0.1:2*pi;
xd=215;yd=0;
l2=160;
l3=160;
l=120;
omigl=2;
xb=xa+l1*cos(fil1);
yb=ya+l1*sin(fil1);
vbx=-omigl*l1*sin(fil1);
vby=omigl*l1*cos(fil1);
abx=-omigl*omigl*l1*cos(fil1);
aby=-omigl*omigl*l1*sin(fil1);
h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb));
delta=atan((yd-yb)/(xd-xb));
gama=acos((h*h+l2*l2-l3*l3)/(2*h*l2));
fil2=gama-delta;
xc=xb+l2*cos(fil2);
yc=yb+l2*sin(fil2);
omigl3=((-vbx)*(xc-xb)+(-vby)*(yc-yb))/((yc-yd)*(xc-xb)-(yc-yb)*(xc-xd));
omigl2=((-vbx)*(xc-xd)+(-vby)*(yc-yd))/((yc-yd)*(xc-xb)-(yc-yb)*(xc-xd));
e=-abx+omigl2*omigl2*(xc-xb)-omigl3*omigl3*(xc-xd);
f=-aby+omigl2*omigl2*(yc-yb)-omigl3*omigl3*(yc-yd);
vcx=vbx-l2*omigl2*sin(fil2);
vcy=vby+l2*omigl2*cos(fil2);
el2=(e*(xc-xd)+f*(yc-yd))/((xc-xb)*(yc-yd)-(xc-xd)*(yc-yb));
acx=abx-el2*(yc-yb)-omigl2*omigl2*(xc-xb);
acy=aby+el2*(xc-xb)-omigl2*omigl2*(yc-yb);
plot(fil1,xc,'-g',fil1,yc,'-b',fil1,vcx,'-r',fil1,vcy,'-m',fil1,acx,'-',fil1,acy,'-')
其实我只想用MATLAB替我画个图,对一个六连杆机构进行分析,但就是运行不出来.
在matlab中,我输入这个语句h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb)),系统告诉我必须是标量或者是方阵在matlab中,我输入这个语句h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb,系统告诉我什么必须是标量或者是方阵才行
h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb))
你的目的是矩阵中对应的元素做运算
所以请将式中的“*”号改为“.*”(点乘)再试试