User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Mae 315 - tu (need matlab help) Page [1]  
towndrunk
Veteran
119 Posts
user info
edit post

the required problem is 2x''+9x=0 x(0)=1 x'(0)=2
he gave us what should be the solution but i cant get it to turn out

system1.m
>>edit

%in system1.m
f=zeros(2,1);
functionf=f(t,x)
f=zeros(2,1);
f(1)=(2);
f(2)=-4.5*x(1);

system2.m
>>edit

%in system2.m
time=0:0.001:15;
time=time';
xo=[1;2]
[t,x]=ode45('system1.m',time,x0)
plot(t,x(:,1));
xlabel('time,sec');
ylabel('displacement,m');
title('first response simulation')

>>system2






any help??

2/1/2006 9:25:47 PM

jwb9984
All American
14039 Posts
user info
edit post

http://www.thewolfweb.com/message_topic.aspx?topic=384293

p.s. 2x''+9x=0 isnt the problem he gave us. it was just the example he did in class

2/1/2006 9:27:20 PM

towndrunk
Veteran
119 Posts
user info
edit post

i know but if i can get that one to work then i can do the other one....

2/1/2006 9:30:40 PM

JonHGuth
Suspended
39171 Posts
user info
edit post

heres the example, then use the other thread

%system1.m
function f=f(t,x)
f=zeros(2,1);
f(1)=x(2);
f(2)=-4.5*x(1)

%this is an executable to simulate vibration
%described by system1.m
%filename: myluckyday.m
%free response simulation
time=0:0.01:15;
time=time';
x0=[1:2]; %initial condition
[t,x]=ode45('system1',time,x0);
plot(t,x(:,1));
xlabel('time, sec')
ylabel('Displacement, m');
title('First Try')

2/1/2006 9:32:38 PM

jwb9984
All American
14039 Posts
user info
edit post

that's exactly it. so all you have to do is just change your f(2) and you x0

2/1/2006 9:39:39 PM

 Message Boards » Study Hall » Mae 315 - tu (need matlab help) Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.