Info

この質問は閉じられています。 編集または回答するには再度開いてください。

too many output argumentws

1 回表示 (過去 30 日間)
ajinkya bhoi
ajinkya bhoi 2020 年 6 月 7 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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
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
Vishal Gaur 2020 年 6 月 8 日
Your Code is correct. Check if you have misspelled any argument name or the function name.

この質問は閉じられています。

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by