clc,close all,clear
%
% simulink2matlab.m - get responses of diff equation form simulink
%
Tmax = 50;          % Sim time
x0 = 10;            % Initial condition 
dx = 0;             % Initial condition
%
% Sim system
%
sim('simulink2matlab_2_m.mdl',Tmax);

%
% Plot responses (1)
%
t = ScopeData.time;
y1 = ScopeData.signals(1).values;
y2 = ScopeData.signals(2).values;
y3 = ScopeData.signals(3).values;
y4 = ScopeData.signals(4).values;

subplot(4,1,1)
    plot(t,y1,'LineWidth',2)
    xlabel('Time[s]');
    ylabel('Amplitude')
    grid on
    legend('u(t)')
subplot(4,1,2)
    plot(t,y2,'LineWidth',2)
    xlabel('Time[s]');
    ylabel('Amplitude')
    legend('x''''(t)')
    grid on
subplot(4,1,3)
    plot(t,y3,'LineWidth',2)
    xlabel('Time[s]');
    ylabel('Amplitude')
    legend('x''(t)')
    grid on
subplot(4,1,4)
    plot(t,y4,'LineWidth',2)
    xlabel('Time[s]');
    ylabel('Amplitude')
    legend('x(t)')
    grid on    
    
    
    
    
    
    
    
    
    
    