HW2_1b - state1(:,i) = subs( xpt, t, time1(i) ); u1 = subs(...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
% Linear Systems, Homework 2 % Date: 11/13/06 % File: HW2_1b.m % Name: Feng-Li Lian, fengli@ntu.edu.tw % close all; clear all; c %syms R1 R2 L C s t tau % % 1a % R1 = 2; R2 = 10; L = 0.5; C = 1; C Ap = [ -R1/L -1/L; 1/C -1/(C*R2)]; Bp = [ 1/L ; 0 ]; Cp = [ 0 1 ]; Dp = 0; D eig(Ap) e Sysp = ss(Ap,Bp,Cp,Dp); S [Nump, Denp] = ss2tf( Ap, Bp, Cp, Dp ); [ % state-space solution % % mehtod 1: by direct calculation % syms t tau s xp0 = zeros(2,1); u = 1; %u = sin(0.5*pi*tau); % expAp = expm( Ap * t ); e zi = expAp * xp0 z zs = int( expm( Ap*(t-tau) ) * Bp * u, tau, 0, t ) z xpt = zi + zs x subs( xpt, t, 1 ) s for i=1:101 time1(i) = (i-1)*0.1;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: state1(:,i) = subs( xpt, t, time1(i) ); u1 = subs( u, tau, time1(i) ); output1(i) = Cp*state1(:,i) + Dp*u1; end e figure(11) subplot(211) plot(time1,state1) xlabel('time'); ylabel('state'); subplot(212) plot(time1,output1,'g') xlabel('time'); ylabel('output'); x % mehtod 2: by step function % [output2,time2,state2] = step(Sysp,10); [ figure(21) subplot(211) plot(time2,state2) xlabel('time'); ylabel('state'); subplot(212) plot(time2,output2,'g') xlabel('time'); ylabel('output'); x % mehtod 3: by ode45 solver % see the other set of files %...
View Full Document

This note was uploaded on 07/21/2009 for the course EE 901-43400 taught by Professor Feng-lilian during the Fall '08 term at National Taiwan University.

Page1 / 2

HW2_1b - state1(:,i) = subs( xpt, t, time1(i) ); u1 = subs(...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online