Please consider 2 scripts below, this supposed to be output the same results of D but it doesn't
script 1:
m_s = 2000; %(kg) Sprung mass
m_u = 200; %(kg) Un-sprung mass
k_s = 200000; %(N/m) Suspension stiffness
k_u = 870000; %(N/m) Tire stiffness
c_s = 6000; %(Ns/m) Damping coefficient
M = [m_u 0;0 m_s];
K = [k_s+k_u -k_s; -k_s k_s];
A = M\K;
[V,D] = eig(A);
D
script 2:
m_s = 2000; %(kg) Sprung mass
m_u = 200; %(kg) Un-sprung mass
k_u = 870000; %(N/m) Tire stiffness
c_s = 6000; %(Ns/m) Damping coefficient
syms k_s
M = [m_u 0;0 m_s];
K = [k_s+k_u -k_s; -k_s k_s];
A = M\K;
[V,D] = eig(A);
k_s = 200000;
D=double(subs(D))
THANK YOU!

댓글 수: 9

ali hassan
ali hassan 2020년 11월 27일
are your inputs complete??
i dont think so
KSSV
KSSV 2020년 11월 27일
Give the complete code which you have tried.....the inputs which lead to the given output is not shown. Without this how you expect us to help you?
Tran Gia Minh
Tran Gia Minh 2020년 11월 27일
Sorry for that, INPUT is another file which contains input variables
I have just updated the scripts, if you have time please take a look.
ali hassan
ali hassan 2020년 11월 27일
편집: ali hassan 2020년 11월 27일
try this. hope it will work
%%script 1:
m_s = 2000; %(kg) Sprung mass
m_u = 200; %(kg) Un-sprung mass
k_s = 200000; %(N/m) Suspension stiffness
k_u = 870000; %(N/m) Tire stiffness
c_s = 6000; %(Ns/m) Damping coefficient
M = [m_u 0;0 m_s];
K = [k_s+k_u -k_s; -k_s k_s];
A = M\K;
[V,D] = eig(A);
D
%% %%script 2:
m_s = 2000; %(kg) Sprung mass
m_u = 200; %(kg) Un-sprung mass
k_u = 870000; %(N/m) Tire stiffness
c_s = 6000; %(Ns/m) Damping coefficient
syms k_s
M = [m_u 0;0 m_s];
K = [k_s+k_u -k_s; -k_s k_s];
A = M\K;
[V,D] = eig(A);
k_s = 200000;
% D=double(subs(D))
double(subs(D))
ali hassan
ali hassan 2020년 11월 27일
편집: ali hassan 2020년 11월 27일
plzzz reply if it worked??
i am sure it worked.
you were actually making a mistake using sub.firstly, try to keep code simple. u dont need to use symbolic variables when you are going to give the value later coz there is no reason to add lines.
hope answers the question
BEST REGARDS
Tran Gia Minh
Tran Gia Minh 2020년 11월 27일
Unfortunately, they still give different result,
Thank you for your patient Ali Hassan!
I try symbolic variables for a specific purpose of my own.
Tran Gia Minh
Tran Gia Minh 2020년 11월 27일
in script 1 you provided, result of D is:
D =
1.0e+03 *
5.3690 0
0 0.0810
and script2:
D =
1.0e+03 *
0.0810 0
0 5.3690
ali hassan
ali hassan 2020년 11월 27일
편집: ali hassan 2020년 11월 27일
brother these are eigen values and you have got two answers and the position does'nt matter in my reckoning.
did u get it or i need to explain more??
if u want i can
ali hassan
ali hassan 2020년 11월 27일
actually i hope you know but just to remind you.
actually D is a scalor value and when it is multipled with the eigen vector it satisfies the equation
wA = Dw
here D is a scalor value and you have got two different values which means when you will multiply your two values one by one with the eigen vector, you must get the left side of equation(wA) and it is true in your case. so dont get puzzled with the sequence.

댓글을 달려면 로그인하십시오.

 채택된 답변

VBBV
VBBV 2020년 11월 27일
편집: VBBV 2020년 11월 27일

0 개 추천

D=double(subs(D,k_s))
Use the variable k_s as argument, I get the same results now
m_s = 2000; %(kg) Sprung mass
m_u = 200; %(kg) Un-sprung mass
k_s = 200000; %(N/m) Suspension stiffness
k_u = 870000; %(N/m) Tire stiffness
c_s = 6000; %(Ns/m) Damping coefficient
M = [m_u 0;0 m_s];
K = [k_s+k_u -k_s; -k_s k_s];
A = M\K;
[V,D] = eig(A);
D
D =
1.0e+03 *
5.3690 0
0 0.0810
clear
m_s = 2000; %(kg) Sprung mass
m_u = 200; %(kg) Un-sprung mass
k_u = 870000; %(N/m) Tire stiffness
c_s = 6000; %(Ns/m) Damping coefficient
syms k_s
M = [m_u 0;0 m_s];
K = [k_s+k_u -k_s; -k_s k_s];
A = M\K;
[V,D] = eig(A);
k_s = 200000;
D=double(subs(D,k_s))
D =
1.0e+03 *
5.3690 0
0 0.0810

댓글 수: 1

VBBV
VBBV 2020년 11월 27일
편집: VBBV 2020년 11월 27일
Use clear statment in the begnning of 2nd script

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

VBBV
VBBV 2020년 11월 27일

0 개 추천

It depends on values for input variables inside the M and K matrices If you use different values for each of script the resulting D will not be same

댓글 수: 1

ali hassan
ali hassan 2020년 11월 27일
***if we use same values for each of script the resulting D will not be same.
right???

댓글을 달려면 로그인하십시오.

Steven Lord
Steven Lord 2020년 11월 27일
편집: Steven Lord 2020년 11월 27일

0 개 추천

m_s = 2000; %(kg) Sprung mass
m_u = 200; %(kg) Un-sprung mass
k_s = 200000; %(N/m) Suspension stiffness
k_u = 870000; %(N/m) Tire stiffness
c_s = 6000; %(Ns/m) Damping coefficient
M = [m_u 0;0 m_s];
K = [k_s+k_u -k_s; -k_s k_s];
A = M\K;
[Vdbl,Ddbl] = eig(A);
Ddbl;
syms k_s
M = [m_u 0;0 m_s];
K = [k_s+k_u -k_s; -k_s k_s];
A = M\K;
[Vsym,Dsym] = eig(A);
k_s = 200000;
Dsym2=double(subs(Dsym));
isequal(sort(diag(Ddbl)), sort(diag(Dsym2)))
ans = logical
1
Ddbl and Dsym2 do contain the same diagonal elements, but the order of those elements along the diagonal is not the same. If you swap the columns of Vsym accordingly you'll see that each eigenvector in Vdbl is a non-zero scalar multiple of the corresponding eigenvector in Vsym. If v is an eigenvector of A with eigenvalue d, k*d is also an eigenvector of A with eigenvalue d for any non-zero scalar k.
format longg
Vdbl./fliplr(double(subs(Vsym)))
ans = 2×2
-0.0189755917710498 0.982462249755453 -0.0189755917710498 0.982462249755453
So same answers, just in a different order in the output.

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

질문:

2020년 11월 27일

편집:

2020년 11월 27일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by