Too many input arguments.

4 visualizzazioni (ultimi 30 giorni)
paripavithran sampathu
paripavithran sampathu il 12 Dic 2016
Commentato: Rena Berman il 14 Set 2017
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 Commenti
Rena Berman
Rena Berman il 20 Gen 2017
(Answers Dev) Restored Question.
Rena Berman
Rena Berman il 14 Set 2017
(Answers Dev) Restored edit

Accedi per commentare.

Risposte (1)

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

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by