在matlab中,我输入这个语句h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb)),系统告诉我必须是标量或者是方阵在matlab中,我输入这个语句h=sqrt((xd-xb)*(xd-xb)+ (yd-yb)*(yd-yb,系统告诉我什么必须是标量或者是方阵才行
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/28 23:48:01
在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))
你的目的是矩阵中对应的元素做运算
所以请将式中的“*”号改为“.*”(点乘)再试试