Dear sir, i used ur same code..
%% Task 1: Call ode45 to solve the state-space to produce state responses
tspan = [0 1];
x0 = [108; 66.65; 428]; % <-- non-zero initial values
[t, x] = ode45(@kruthikaSSS, tspan, x0);
%% Task 2: Generate only the output vector y of the state-space system
for j = 1:numel(t)
[~, y(j,:)] = kruthikaSSS(t(j), x(j,:));
end
%% Task 3: Plot Output responses
subplot(311)
plot(t, y(:,1)), grid on, ylabel('y_{1}')
subplot(312)
plot(t, y(:,2)), grid on, ylabel('y_{2}')
subplot(313)
plot(t, y(:,3)), grid on, ylabel('y_{3}'), xlabel('t')
%% State-Space System
function [xdot, y] = kruthikaSSS(t, x)
% initialzation
xdot = zeros(3, 1);
y = zeros(3, 1);
% definitions
x1 = x(1);
x2 = x(2);
x3 = x(3);
% Input signals: step functions
u1 = (t >= 0)*1;
u2 = u1;
u3 = u2;
% ODEs
xdot(1) = (-0.0018*u2*x1^(9/8)) + (0.9*u1) - (0.15*u3);
xdot(2) = ((((0.73*u2)-0.16)*x1^(9/8)-x2))/10;
xdot(3) = ((141*u3)-((1.1*u2)-0.19)*x1)/85;
% Outputs
y(1) = x1;
y(2) = x2;
y(3) = 0.05*((0.13073*x3) + (100*((1-(0.001538*x3))*((0.8*x1)-25.6))/(x3*(1.0394-0.00123404*x1))) +(((((0.854*u2) -0.147)*x1) + (45.59*u1) -(2.514*u3) -2.096)/9) -67.975);
end
but i get ERROR as: Error using plot
Vectors must be the same length.
Error in nonzeroinitial (line 11)
plot(t, y(:,1)), grid on, ylabel('y_{1}')
can u pls help me with this?