plugin-math245lab10

# plugin-math245lab10 - Math245 Computer Lab set#10 Spring...

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

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

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

Unformatted text preview: Math245 Computer Lab set #10, Spring 2009 Response to step input In this lab, we will simulate the 2nd order ODE with discontinuous forcing function. To start with, we define the step function in Matlab. Then we will simulate an example problem by using the step function for the forcing function. The step function As we learned in the class, the step function u ( t ) is defined u ( t ) = ( t < 1 t ≥ (1) The shifted step function u ( t- c ) is expressed u ( t- c ) = ( t- c < 0 ( t < c ) 1 t- c ≥ 0 ( t ≥ c ) (2) 1 t u(t-c) c 1 t u(t) Design step function in Matlab To define the step function u ( t ), we create a Matlab function file ( step.m ) as follows. function y = step(t) if t < 0 y = 0; else y = 1; end There are two points to make: Matlab function The Matlab function is a independent program unit that has a certain function. The simplest form of the function is written function out = fun_name(in1, in2,...) out = some expression using in1, in2, etc. This function is has its name fun name . And this file should be saved as fun name.m . in1, in2,... are called input arguments, and...
View Full Document

{[ snackBarMessage ]}

### Page1 / 4

plugin-math245lab10 - Math245 Computer Lab set#10 Spring...

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

View Full Document
Ask a homework question - tutors are online