Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
too many output argumentws
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I am getting too many input and output arguments error, I have tried to solve it but i am not able to understand the way to solve.
below is my fucntion
function [x_t,v_t] = Exercise_2_1_solve_equation_of_motion_analytically_func (mass,stiffness,damping,time,x_0,x_dot_0)
%% 2.) Computing
%% 2.) -Parameter calculation
dampingcoefficient = damping/2*mass; % Calculate damping coefficient
angulareigenfrequency = sqrt(stiffness/mass); % Calculate angular eigenfrequency
%% 2.) -Calculation of the characteristic polynomial
lambda = roots([1,2*dampingcoefficient,angulareigenfrequency^2]); %Calculate roots
%% 2.) -Calculation of the constants
k1 = (x_dot_0-lambda(2)*x_0)/(lambda(1)-lambda(2)); % Calculation of the constant 1
k2 = (lambda(1)*x_0-x_dot_0)/(lambda(1)-lambda(2)); % Calculation of the constant 2
%% 2.) -Calculation of the solution
x_t_h = k1*exp(lambda(1)*time)+k2*exp(lambda(2)*time);
v_t_h = k1*lambda(1)*exp(lambda(1)*time)+k2*lambda(2)*exp(lambda(2)*time);
x_t = real(x_t_h); % Make sure only real part is considered
v_t = real(v_t_h); % Make sure only real part is considered
end
And the calling script is as below :
%%To solve equation of motion analytically
%% Parameter definition
mass = 750; % Mass of the body [kg]
stiffness = 50000; % Stiffness Coefficient of spring [N/m]
damping = 1000; % Damping coefficient of damper [Ns/m]
time = 0:0.01:1; % Time [s]
x_0 = 0.01; % Initial Condition displacement
x_dot_0 = 0; % Initial Condition velocity
%% Call the function
[x_t,v_t] = Exercise_2_1_solve_equation_of_motion_analytically_func(mass,stiffness,damping,time,x_0,x_dot_0);
댓글 수: 1
KSSV
2020년 6월 7일
It is running fine....the number of inputs and outputs are correct. Are you giving the function name correct?
답변 (1개)
Vishal Gaur
2020년 6월 8일
Your Code is correct. Check if you have misspelled any argument name or the function name.
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!