Too many input arguments.

조회 수: 5 (최근 30일)
paripavithran sampathu
paripavithran sampathu 2016년 12월 12일
댓글: Rena Berman 2017년 9월 14일
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
Rena Berman
Rena Berman 2017년 1월 20일
(Answers Dev) Restored Question.
Rena Berman
Rena Berman 2017년 9월 14일
(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
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
paripavithran sampathu 2016년 12월 13일
Error using plot Too many input arguments.
Error in my_code (line 68) plot(xa,ya)
Walter Roberson
Walter Roberson 2016년 12월 13일
At the command line, give the command
which plot
and tell us the result.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by