Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Mathematics
General TopicsResearchOperations ResearchStatisticsMathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Math
Math Software
MapleMathematicaMATLABScilabSASSPSS

Math Forum / Math Software / MATLAB / July 2008



Tip: Looking for answers? Try searching our database.

Major problem with program

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Josh - 02 Dec 2007 22:45 GMT
I am working on a class project that I am having a hell of a time with.  I posted a link to a .pdf file that is the actual program.  So far, I have created an .m file with the variables defined and it works fine but now I am having problems with the eigen functions and normalizing vectors.  Any help would be greatly appreciated as I am in a time crunch.  I am not very good with MATLAB so please be gentle.  Thanks!

http://www.ftpp.net/MATLABProject.pdf

Thanks in advance for everyone's help!
Matt Fig - 02 Dec 2007 23:27 GMT
Josh <jcyork01@louisville.edu> wrote in message
<909073.1196635547944.JavaMail.jakarta@nitrogen.mathforum.org>...
> I am working on a class project that I am having a hell of a time with.  I posted a link to a .pdf file that is the
actual program.  So far, I have created an .m file with the
variables defined and it works fine but now I am having
problems with the eigen functions and normalizing vectors.
Any help would be greatly appreciated as I am in a time
crunch.  I am not very good with MATLAB so please be gentle.
Thanks!

> http://www.ftpp.net/MATLABProject.pdf
>
> Thanks in advance for everyone's help!

Post your work so far, you will be more likely to get a
response if people see you are really trying.
Josh - 02 Dec 2007 23:51 GMT
Definitions.m

%Weight Initialization file

% Variable definitions
% Mc: Mass of vehicle(car)
% Jc: Moment of inertia value for vehicle (car)
% Mb: Mass of suspension components
% Jb: Moment of inertia for suspension components
% Mw: Mass of wheel
% K1 - Spring Rate 1
% K2 - Spring Rate 2
% Lw - Wheelbase length - left to right
% Lb - Wheelbase length - front to rear

% << Variable Definitions - Values
Lb=2.57; %meters
Lw = 1.52; %meters
K1 = 60; %Spring Rate: kg*m^2
K2 = 50; %Spring Rate: kg*m^2
Mc=1500; %Mass of vehicle
Jc=1114.4; %Moment of Inertia - Vehicle
Mb=25; %Mass of Suspension Pieces
Jb=.3; %Moment of Inertia - Suspension
Mw=20.0; %Mass of Wheel

% Mv = [Mc Jc Mb Jb Mb Jb Mw Mw Mw Mw] in a diagonal fashion
% Mv[1,10]
Mv = [Mc 0 0 0 0 0 0 0 0 0; 0 Jc 0 0 0 0 0 0 0 0; 0 0 Mb 0 0 0 0 0 0 0; 0 0 0 Jb 0 0 0 0 0 0; 0 0 0 0 Mb 0 0 0 0 0; 0 0 0 0 0 Jb 0 0 0 0; 0 0 0 0 0 0 Mw 0 0 0; 0 0 0 0 0 0 0 Mw 0 0; 0 0 0 0 0 0 0 0 Mw 0; 0 0 0 0 0 0 0 0 0 Mw];
Kv = [(2*K2) 0 -K2 0 -K2 0 0 0 0 0; 0 (2*K2*Lb^2) (-K2*Lb) 0 (K2*Lb) 0 0 0 0 0; -K2 (-K2*Lb) (K2+2*K1) 0 0 0 -K1 -K1 0 0; 0 0 0 (2*K1*Lw^2) 0 0 (-K1*Lw) (K1*Lw) 0 0; -K2 (K2*Lb) 0 0 (K2+2*K1) 0 0 0 -K1 -K1; 0 0 0 0 0 (2*K1*Lw^2) 0 0 (-K1*Lw) (K1*Lw); 0 0 -K1 (-K1*Lw) 0 0 K1 0 0 0; 0 0 -K1 (K1*Lw) 0 0 0 K1 0 0; 0 0 0 0 -K1 (-K1*Lw) 0 0 K1 0; 0 0 0 0 -K1 (K1*Lw) 0 0 0 K1];

% To get Eigen values and vectors: [K, M]=eig(Kv, Mv)
% Note: Eigenvalue is M, Eigenvector is M
[K, M]=eig(Kv, -Mv)

% fn = natural frequency
fn = M/(2*pi)

% Eliminate Zeroes
sparse(fn)
John D'Errico - 03 Dec 2007 00:17 GMT
Josh <jcyork01@louisville.edu> wrote in message
<18956547.1196639536763.JavaMail.jakarta@nitrogen.mathforum.org>...
> Definitions.m
>
[quoted text clipped - 25 lines]
> % Mv[1,10]
> Mv = [Mc 0 0 0 0 0 0 0 0 0; 0 Jc 0 0 0 0 0 0 0 0; 0 0 Mb 0 0 0 0 0 0 0; 0 0 0 Jb 0 0 0 0 0 0; 0 0 0 0 Mb 0 0 0 0 0; 0 0 0 0 0 Jb 0 0 0 0; 0 0 0 0 0 0 Mw 0 0 0;
0 0 0 0 0 0 0 Mw 0 0; 0 0 0 0 0 0 0 0 Mw 0; 0 0 0 0 0 0 0 0 0 Mw];
> Kv = [(2*K2) 0 -K2 0 -K2 0 0 0 0 0; 0 (2*K2*Lb^2) (-K2*Lb) 0 (K2*Lb) 0 0 0 0 0; -K2 (-K2*Lb) (K2+2*K1) 0 0 0 -K1 -K1 0 0; 0 0 0 (2*K1*Lw^2) 0 0 (-
K1*Lw) (K1*Lw) 0 0; -K2 (K2*Lb) 0 0 (K2+2*K1) 0 0 0 -K1 -K1; 0 0 0 0 0
(2*K1*Lw^2) 0 0 (-K1*Lw) (K1*Lw); 0 0 -K1 (-K1*Lw) 0 0 K1 0 0 0; 0 0 -K1
(K1*Lw) 0 0 0 K1 0 0; 0 0 0 0 -K1 (-K1*Lw) 0 0 K1 0; 0 0 0 0 -K1 (K1*Lw) 0 0
0 K1];

> % To get Eigen values and vectors: [K, M]=eig(Kv, Mv)
> % Note: Eigenvalue is M, Eigenvector is M
[quoted text clipped - 5 lines]
> % Eliminate Zeroes
> sparse(fn)

Um, sparse does not actually eliminate any zeros.
This is not its purpose, nor does it really have
that effect, even if unintentional.

So what is your purpose here? My guess is that
you wish to extract only the diagonal elements
of the diagonal matrix that eig returns. Use
diag for this purpose.

John
Josh - 03 Dec 2007 01:21 GMT
Great!  I used the diag function and it worked great.  Thanks for that.  Still in need of more help!
John D'Errico - 03 Dec 2007 11:26 GMT
Josh <jcyork01@louisville.edu> wrote in message
<21914604.1196644917957.JavaMail.jakarta@nitrogen.mathforum.org>...
> Great!  I used the diag function and it worked great.  Thanks for that.  Still in need of more help!

Ok. So you need more help. On what? Give us
a hint, since at least my own crystal ball is
always hazy. What did you try? What is wrong?

John
richard lane - 31 Jul 2008 18:29 GMT
check a book by Ogota and the matlab help files for tutorials. they helped me.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.