# the transfer function is therefore

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 0 0; 0 0]; %D matrix ourmodel=ss(A,B,C,D); %state space model tic; yhist=lsim(ourmodel, uhist, thist, x0); %yhistory ttot=toc; plot(thist,yhist(:,2)+h_2eq); %plot xlabel('time (seconds)'); %xlabel ylabel('position (meters)'); %ylabel title('height position time history for tank 1') %title %thist,yhist(:,2)+h_2eq Challenge Problem Matlab Code %{ This function plots the response of A state space model based on the form: xdot=Ax+Bu, y=Cx+Du where x contains n variables for the state space model A contains a n by n matrix of state space coefficients B contains a 1 by n matrix of forcing function coefficients c and D must have the same number of rows %} thist=[0:.002:100]; %time history vector uhist=2*sin(10*thist+3.2)+4*sin(55*thist+5.1); %input forcing function x0=[0 0 0 0 0 0];%intial conditions m=200; k=300000; b=2000; ma=3; ka=300; mb=3; kb=9075; %variables A=[0, 1, 0, 0, 0, 0;... -(k+ka+kb)/m, -b/m, ka/m, 0, kb/m, 0;... 0, 0, 0, 1, 0, 0;... ka/ma, 0, -ka/ma, 0, 0, 0;... 0, 0, 0, 0, 0, 1;... kb/mb, 0, 0, 0, -kb/mb, 0]; %A matrix B=[0; 1/m; 0; 0; 0; 0]; %B matrix C=[1, 0, 0, 0, 0, 0;... 0, 0, 1, 0, 0, 0;... 0, 0, 0, 0, 1, 0]; %C mareix D=[0;0;0]; %D matrix ourmodel=ss(A,B,C,D); %input state space mode yhist=lsim(ourmodel, uhist, thist, x0); %yhist figu...
View Full Document

Ask a homework question - tutors are online