Too many input arguments.
이전 댓글 표시
clear all;
clc;
syms q1 q2 q3 q4 qt1 qt2 qt3 qt4 m1 m2 m3 m4 l1 l2 l3 l4 h1 h2 h3 h4 g x
syms I1 I2 I3 I4 Q1 Q2 Q3 Q4 qtt1 qtt2 qtt3 qtt4 t real
dbstop if error
l1=27;
l2=23;
l3=19.8;
l4=5;
g=9.80665;
m1=23.687;
m2=17.15;
m3=2.0125;
m4=0.4179;
h1=765;
h2=568;
h3=418;
h4=220;
I1=0.099379;
I2=0.050526;
I4=0.000405;
I3=0.000702;
xvals =0: 0.1:10;
nx = length(xvals);
[xa, xb, xc, xd, ya, yb, yc, yd] = deal(zeros(1,nx));
for xidx = 1 : length(xvals)
x = xvals(xidx);
q1=3-(3*cos(pi*x/10));
qt1=3*sin(pi*x/10)*pi/10;
qtt1=3*cos(pi*x/10)*(pi^2/100);
q2=0;
qt2=0;
qtt2=0;
% q2=3-(3*sin(pi*x/10));
% qt2= -3*cos(pi*x/10)*(pi/10);
% qtt2=3*sin(pi*x/10)*(pi^2/100);
qt3=0.198*x;
qtt3=0.198*x;
qtt4=sin(x)+cos(x);
Q1=qtt2*((l1*l2*m2*cos(q2))/2 + l1*l2*m3*cos(q2)) - qt2*((l1*l2*m2*qt2*sin(q2))/2 + l1*l2*m3*qt2*sin(q2)) + qtt1*(2*I1 + (2*l1^2*m1)/3 + l1^2*m2 + l1^2*m3);
Q2=qtt2*(2*I2 + (l2^2*m2)/4 + l2^2*m3) + qtt1*((l1*l2*m2*cos(q2))/2 + l1*l2*m3*cos(q2)) - qt2*((l1*l2*m2*qt1*sin(q2))/2 + l1*l2*m3*qt1*sin(q2)) + (l1*l2*m2*qt1*qt2*sin(q2))/2 + l1*l2*m3*qt1*qt2*sin(q2);
Q3=g*m3*qtt3 - g*m4 - (g*m3)/2;
Q4=l4^2*m4*qtt4;
xa(xidx)= l1* cos(Q1);
ya(xidx)=l1* sin(Q1);
xb(xidx)=(l1+l2) * cos(Q2);
yb(xidx)=(l1+l2) * sin(Q2);
xc(xidx)=(l1+l2)* cos(Q3);
yc(xidx)= qtt3*g* sin(Q3);
xd(xidx)=(l1+l2+l4) * cos(Q4);
yd(xidx)=(l1+l2+l4) * sin(Q4);
end
hold on
plot(xa,ya)
plot(xb,yb)
plot(xc,yc)
plot(xd,yd)
hold off
댓글 수: 9
James Tursa
2016년 12월 13일
You are passing in too many inputs to a function. Please post your code and we can provide more detailed advice.
James Tursa
2016년 12월 13일
What line is generating the error? Please copy & paste the entire error message including the offending line.
paripavithran sampathu
2016년 12월 13일
편집: Walter Roberson
2016년 12월 13일
Jan
2016년 12월 13일
@paripavithran sampathu: Again: Please post the complete error message.
paripavithran sampathu
2016년 12월 13일
편집: Walter Roberson
2016년 12월 13일
José-Luis
2016년 12월 13일
Could you please post the error message.
José-Luis
2016년 12월 13일
And the output of
which plot
is?
Rena Berman
2017년 1월 20일
(Answers Dev) Restored Question.
Rena Berman
2017년 9월 14일
(Answers Dev) Restored edit
답변 (1개)
Walter Roberson
2016년 12월 13일
Your code works for me. I just put it into a file and commented out the "clear all" and "clc" (because those have no business being inside programs; If I wanted to clear the screen I would clear the screen!) .
I suspect that somewhere on your path you have your own plot.m routine. What shows up if you use
which plot
댓글 수: 4
paripavithran sampathu
2016년 12월 13일
Walter Roberson
2016년 12월 13일
Please show the output of
which plot
paripavithran sampathu
2016년 12월 13일
Walter Roberson
2016년 12월 13일
At the command line, give the command
which plot
and tell us the result.
카테고리
도움말 센터 및 File Exchange에서 Numbers and Precision에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!