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 Page [1]  
baseball5
New Recruit
32 Posts
user info
edit post

Anybody else having trouble getting the MATLAB assignment done? I've got both of the m-files created, i just can't get the program to run without errors. If you think you can help please let me know.

2/1/2006 4:42:11 PM

strudle66
All American
1573 Posts
user info
edit post

i had Tu for 315 last year, if you post the assignment i can probably help you out with the MATLAB code

2/1/2006 6:22:48 PM

lockrugger
Veteran
122 Posts
user info
edit post

% This is my function program.
% System.m
function f=f(t,x)
f= zeros(2,1);
f(1) = x(2);
f(2) = -6.5*x(1);

%This is my executable file to simulate the vibration system
%that is defined in file "System.m"
%File name = larrywhysallmatlab315.m
%This is a free response simulation
time = 0:0.01:15;
time = time';
x0 = [1,2];
[t,x]=ode45('system1',time,x0);
plot (t,x(:,1));
plot (t,x(:,2));
plot (t,x);
xlabel ('Time in seconds');
ylabel ('Displacement');
title ('Displacement vs. Time of 2x"+13x=0');

2/1/2006 7:09:25 PM

lockrugger
Veteran
122 Posts
user info
edit post

nm....really simple error. filenames didnt match.

2/1/2006 7:21:41 PM

JonHGuth
Suspended
39171 Posts
user info
edit post

i thought it was 2x"+3x=0
is it supposed to be 13x?
^^ what problem is that? now im really confused


[Edited on February 1, 2006 at 8:32 PM. Reason : .]

2/1/2006 8:29:45 PM

jwb9984
All American
14039 Posts
user info
edit post

the problem is 2x'' + 13x = 0

1.) x(0) = 3 ; x'(0) = 0

2.) x(0) = 0 ; x'(0) = 4

3.) x(0) = 2 ; x'(0) = 7

2/1/2006 9:21:25 PM

JonHGuth
Suspended
39171 Posts
user info
edit post

^^^^ initial conditions are wrong}

[Edited on February 1, 2006 at 9:50 PM. Reason : [3;0]]

2/1/2006 9:24:02 PM

baseball5
New Recruit
32 Posts
user info
edit post

Here is my code...

%system2.m
function f = f(t,x)
f = zeros(3,0);
f(1)=x(2);
f(2)=-6.5*x(1);

%This is an executable file to simulate the vibration system defined by
%system2.m
%filename = vibration1
%Free Response Simulation
time = 0:0.01:15;
time=time';
x0 = [3;0];
[t,x] = ode45('system2',time,x0);
plot(t,x(:,1));
xlabel('time,sec')
ylabel('Displacement');
title('Vibration System');


I get the following errors. Any ideas?

??? Error using ==> funfun\private\odearguments
SYSTEM2 must return a column vector.

Error in ==> ode45 at 173
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...

Error in ==> vibration1 at 8
[t,x] = ode45('system2',time,x0);

2/2/2006 12:21:52 AM

Nerdchick
All American
37009 Posts
user info
edit post

make sure the 2 sections are different files, you have to reference the first part in the second part

2/2/2006 12:23:07 AM

baseball5
New Recruit
32 Posts
user info
edit post

Could you clarify? Both of these are different files. Do I need to add something in or what?

2/2/2006 12:26:37 AM

jwb9984
All American
14039 Posts
user info
edit post

%system2.m
function f = f(t,x)
f = zeros(3,0);
f(1)=x(2);
f(2)=-6.5*x(1);

the bolded part should read

f=zeros(2,1);


edit:
[t,x] = ode45('system2',time,x0);

also make sure that he bold part here is what you actually saved your first m file as

[Edited on February 2, 2006 at 12:38 AM. Reason : .]

2/2/2006 12:35:55 AM

MyCarSucks
All American
5600 Posts
user info
edit post

if anyone is still up, i keep getting this error

??? Input argument 'x' is undefined.
On line 4 ==> f(1)=x(2);

[Edited on February 2, 2006 at 3:29 AM. Reason : ]

2/2/2006 3:27:53 AM

Nerdchick
All American
37009 Posts
user info
edit post

what answers did you guys get for this hw

they're not in the back so hopefully we can figure it out

I've only done the 1st one, I got c=2.71

[Edited on February 13, 2006 at 8:51 PM. Reason : .]

2/13/2006 8:49:08 PM

CalledToArms
All American
22025 Posts
user info
edit post

i worked on the second problem and got .0337, .112, .19 buti have no idea if i even came close to doing it right.

2/13/2006 8:59:42 PM

Nerdchick
All American
37009 Posts
user info
edit post

what did you get for the first one?

2/13/2006 9:01:19 PM

CalledToArms
All American
22025 Posts
user info
edit post

didnt get anything yet :-x. working on the 3rd one atm.

i wrote the first one down but ive yet to really try and work on it

2/13/2006 9:04:35 PM

jwb9984
All American
14039 Posts
user info
edit post

i got 2.73 for the first problem

2/13/2006 9:31:16 PM

CalledToArms
All American
22025 Posts
user info
edit post

any of you have answers for 2 or 3? i guess i should go back to trying to look at 1 and see if i get around 2.7something

2/13/2006 9:38:34 PM

jwb9984
All American
14039 Posts
user info
edit post

what'd you guys get for 2.95?

[Edited on February 13, 2006 at 10:37 PM. Reason : .]

2/13/2006 10:37:03 PM

CalledToArms
All American
22025 Posts
user info
edit post

the only ones ive really gotten answers to so far are 2.88 and 2.90 and im not sure if they are right

2/13/2006 10:42:55 PM

CalledToArms
All American
22025 Posts
user info
edit post

anyone get thsoe same numbers for the second problem?

i dont really feel like i understand this stuff. unless there is a straightforward fomula in the section i dont feel like i can answer the hw problem

[Edited on February 13, 2006 at 10:53 PM. Reason : ]

2/13/2006 10:48:30 PM

jwb9984
All American
14039 Posts
user info
edit post

i didnt get what you got, no

2/13/2006 11:13:37 PM

CalledToArms
All American
22025 Posts
user info
edit post

blah. thanks for letting me know tho.

what did you guys do for #1?

2/13/2006 11:22:07 PM

Nerdchick
All American
37009 Posts
user info
edit post

for 2.88 a I got 26%

for b I got 7%

2/13/2006 11:48:18 PM

jwb9984
All American
14039 Posts
user info
edit post

^yep. same here

2/14/2006 12:15:15 AM

Nerdchick
All American
37009 Posts
user info
edit post

just finished 2.90, I got cc=1000

Wd=8.66

delta = 3.63

how about you guys? I hate not having the answers in the back

2/14/2006 12:34:22 AM

CalledToArms
All American
22025 Posts
user info
edit post

i really hate that too. and im kinda struggling in here. im not getting the answers you guys are getting for 1 or 2. i did get 1000 for C in 2.90. my numbers for b and c were different but i calculated Wn i realize instead of Wd. which would affect my answer in C as well. and thats probably the only thing i did wrong there.

i se the formula for Wd = sqrtroot ( 1 - L^2)*Wn where L is the damping ratio squiggly thing heh.

but, as in the previous problem obviously (since i got different numbers) i am not calculationg L right

2/14/2006 12:44:07 AM

lumbeestud
Veteran
352 Posts
user info
edit post

so I was looking on Tu's syllabus and it said we have to solve the problems and write out an explanation beside of it, does anybody know if he takes off points for that!

2/14/2006 12:45:51 AM

CalledToArms
All American
22025 Posts
user info
edit post

i hope not, but then again i have hardly anything to get points for in the first place

[Edited on February 14, 2006 at 12:58 AM. Reason : ]

2/14/2006 12:56:29 AM

Nerdchick
All American
37009 Posts
user info
edit post

for 2.90, "L" is c/cc

they give you cc in part b, and you calculated c right for part a

2/14/2006 1:08:41 AM

CalledToArms
All American
22025 Posts
user info
edit post

alright thanks a lot

2/14/2006 1:22:40 AM

JonHGuth
Suspended
39171 Posts
user info
edit post

when is this hw due? tomorrow or thurs?

2/20/2006 5:03:03 PM

JonHGuth
Suspended
39171 Posts
user info
edit post

ok, anyone having any luck with the matlab for 3.3

2/22/2006 6:30:35 PM

JonHGuth
Suspended
39171 Posts
user info
edit post

anyone? buller?

2/22/2006 11:48:31 PM

 Message Boards » Study Hall » MAE 315 Tu 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.