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 Comments

You are passing in too many inputs to a function. Please post your code and we can provide more detailed advice.
What line is generating the error? Please copy & paste the entire error message including the offending line.
plot(xa,ya)
plot(xb,yb)
plot(xc,yc)
plot(xd,yd)
Jan
Jan on 13 Dec 2016
@paripavithran sampathu: Again: Please post the complete error message.
@jan simon equations are working well for me, when i am trying to plot its show too input aruguments
plot(xa,ya)
plot(xb,yb)
plot(xc,yc)
plot(xd,yd)
Could you please post the error message.
And the output of
which plot
is?
(Answers Dev) Restored Question.
(Answers Dev) Restored edit

Sign in to comment.

Answers (1)

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 Comments

Equations are Working for me, I can't able to plot my grah
Please show the output of
which plot
Error using plot Too many input arguments.
Error in my_code (line 68) plot(xa,ya)
At the command line, give the command
which plot
and tell us the result.

Sign in to comment.

Commented:

on 14 Sep 2017

Community Treasure Hunt

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

Start Hunting!