MATLAB
Matlab
Matlab
Question number 01:
Matlab code:
function [ yt, Tau, Tr, Tp, Mp ] = Specification(tspan, y0, wn, zeta, theta, N, str)
%Specification Summary of this function goes here
% Detailed explanation goes here
if( nargin < 7 | nargin > 7)
error ('Too many input arguments or too less input arguments');
elseif ( nargin == 7 )
N = 100;
if (str=='y')
if ( tspan(1)<0 | tspan(2)< tspan(1))
error('inital time should be greater than equal to zero and final time should be greater than or equal to initial time');
end
end
else
end
t = linspace (tspan(1),tspan(2),N);
yt = (y0./(sqrt(1-(zeta*zeta)).* exp((-zeta*wn*t).* sin(wn* sqrt(1-(zeta*zeta*t)+ theta )))));
Tau = 1/(zeta * wn);
Tr = ...