MATLAB: Too many input arguments Error using Polyfit..HELP!!!

polyfittoo many input arguments

global I1 I2 P SynM s G D L Polar k;
I1=200; % Moment of intertia of motor (kgm^2)
I2=3000; % Moment of intertia of fan (kgm^2)
P=1000000; % Motor Power
SynM=1500; % Motor synchronous speed RPM
s=0.05; % Motor slip
G=80000000000; % Shaft modulus of Rigidity
D=0.2; % Shaft Diameter
L=1; % Shaft Length
Polar=0.0001571; % (pi*(D^4)/32) – Polar moment of Inertia
k=12568000; % stiffness = (G*J)/L
t0=0; % start time of simulation
tf=60; % end time of simulation
Tf1=P/((2*pi/60)*((1-s)*SynM));
% Torque with full load
M=[0; 20; 40; 60; 65; 70; 75; 80; 85; 90; 95; 100];
% percentage of motor synchronous speed
T=[150; 176; 212; 268; 282; 289; 296; 290; 262; 200; 100; 0];
% percentage of torque with full load
Tm=Tf1.*(T./100);
% Torque motor in N.m
Tf=(0.0033).*(((SynM*(2*pi/60)).*(M./100)).^2);
% Torque fan in N.m
P1=polyfit(((SynM*(2*pi/60)).*(M./100)),Tm,6);
% Coefficient %Pm=polyval(P,Sm); % value of y axis
P2=polyfit(((SynM*(2*pi/60)).*(M./100)),Tf,4);
% Pf=polyval(P2,Sm);
x=[0; 0; 0; 0];
% initial value for z_dot in assignment_function
options=odeset('abstol',1e-6,'reltol',1e-6);
% set value to -6 maximum
[t,z]=ode45('assignment_function',[t0 tf],x,options);
% used ode45 function
plot(t,z); % plot graph
subplot(2,1,1);
plot(t,z(:,2),'r',t,z(:,4),'g');
grid;
title('Angular Velocity against Time');
xlabel('Time (s)');
ylabel('Angular Velocity (rad/s)');
legend('Motor','Fan');
subplot(2,1,2);
plot(t,z(:,1)-z(:,3));
grid;
title('Angle of Twist against Time');
xlabel('Time (s)');
ylabel('Angle of Twist (Rad)');
legend('Angle of twist');
Error using polyfit
Too many input arguments.
Error in Testrun (line 30)
P2=polyfit(((SynM*(2*pi/60)).*(M./100)),Tf,4);

Best Answer

Reinstalled.. Works Perfectly Fine now..
Related Question