hi there i want to get the values of A1,A2,A2,Q1,Q2,Q3 , i have six equations and six initial conditions as Xo, Vo kindly suggest me solution
1 次查看(过去 30 天)
显示 更早的评论
for i = 1:1:3
x(t) = U(i,1)*A1*cos(w2(1,1)*t + Q1) + U(i,2)*A2*cos(w2(2,2)*t + Q2) +U(i,3)*A3*cos(w2(3,3)*t + Q3);
x= x(t);
v= diff(x(t));
end
x
v
Xo = [1 0 0]
Vo = [0 0 0]
% eqns = [x(1,1) == Xo(1,1) , x(1,2) == Xo(1,2), x(1,3) == Xo(1,3), v(1,1) == Vo(1,1) , v(1,2) == Vo(1,2), v(1,3) == Vo(1,3)];
% S = solve(eqns,[A1 A2 A3 Q1 Q2 Q3])
采纳的回答
Walter Roberson
2022-8-2
for i = 1:1:3
x{i} = U(i,1)*A1*cos(w2(1,1)*t + Q1) + U(i,2)*A2*cos(w2(2,2)*t + Q2) +U(i,3)*A3*cos(w2(3,3)*t + Q3);
v{i} = diff(x{i}, t);
end
Xo = [1 0 0]
Vo = [0 0 0]
eqns = [x{1} == Xo(1,1) , x{2} == Xo(1,2), x{3} == Xo(1,3), v{1} == Vo(1,1) , v{2} == Vo(1,2), v{3} == Vo(1,3)];
S = solve(eqns,[A1 A2 A3 Q1 Q2 Q3])
14 个评论
Rahul Jangid
2022-8-2
thanks for that but it is not showing me exact value
it is showing as
S =
struct with fields:
A1: [0×1 sym]
A2: [0×1 sym]
A3: [0×1 sym]
Q1: [0×1 sym]
Q2:
[0×1 sym]
Q3: [0×1 sym]
what should i change ???
Rahul Jangid
2022-8-2
编辑:Walter Roberson
2022-8-2
U = [
-0.3280 0.7370 -0.5910
-0.5910 0.3280 0.7370
-0.7370 -0.5910 -0.3280]
w2 = [
0.1981 0 0
0 1.5550 0
0 0 3.2470]
Walter Roberson
2022-8-2
syms A1 A2 A3 Q1 Q2 Q3 t
U = [
-0.3280 0.7370 -0.5910
-0.5910 0.3280 0.7370
-0.7370 -0.5910 -0.3280]
w2 = [
0.1981 0 0
0 1.5550 0
0 0 3.2470]
for i = 1:1:3
x{i} = U(i,1)*A1*cos(w2(1,1)*t + Q1) + U(i,2)*A2*cos(w2(2,2)*t + Q2) +U(i,3)*A3*cos(w2(3,3)*t + Q3);
v{i} = diff(x{i}, t);
end
Xo = [1 0 0]
Vo = [0 0 0]
eqns = [x{1} == Xo(1,1) , x{2} == Xo(1,2), x{3} == Xo(1,3), v{1} == Vo(1,1) , v{2} == Vo(1,2), v{3} == Vo(1,3)];
S = solve(eqns,[A1 A2 A3 Q1 Q2 Q3])
This gets me 8 solutions when I test.
Note that if really your U or w2 have more digits of precision than you posted, then it is possible that due to small differences in the values that there might not be any solutions.
Rahul Jangid
2022-8-2
bro i need to finally find the response curve for all three masses and plot x1,x2,x3 wrt. t
so here is my code please help
%% Intoroduction of variables
syms m k F1 F2 F3 A1 A2 A3 Q1 Q2 Q3 t
%% Value submission
m=1;
k=1;
% w=1;
%% Mass, Stiffness AND Force matrices
M=[m 0 0
0 m 0
0 0 m];
K = [2*k -k 0
-k 2*k -k
0 -k k] ;
%% Equation of motion
format short
[U,w2] = eig(K,M)
%% Response of the system (here A and Q shows the amplitude and phase difference)
format short
for i = 1:1:3
x(t) = U(i,1)*A1*cos(w2(1,1)*t+Q1) + U(i,2)*A2*cos(w2(2,2)*t+Q2) +U(i,3)*A3*cos(w2(3,3)*t+Q3);
x= x(t);
v= diff(x);
end
x
v
Xo = [1 0 0];
Vo = [0 0 0];
% eqns = [x(1,1) == Xo(1,1) , x(1,2) == Xo(1,2), x(1,3) == Xo(1,3), v(1,1) == Vo(1,1) , v(1,2) == Vo(1,2), v(1,3) == Vo(1,3)];
eqns = [x(1,:) == Xo(1,:) , v(1,:) == Vo(1,:)]'
sol = vpasolve(eqns)
Rahul Jangid
2022-8-2
in previous code w^2 is there so i have corrected it please use this as correct equation
x(t) = U(i,1)*A1*cos(sqrt(w2(1,1))*t+Q1) + U(i,2)*A2*cos(sqrt(w2(2,2))*t+Q2) +U(i,3)*A3*cos(sqrt(w2(3,3))*t+Q3);
Sam Chak
2022-8-2
Rahul, I guess you want to formulate the equations of motion, which are a coupled set of differential equations. Please confirm.
Otherwise, the way you described your problem can be confusing.
Rahul Jangid
2022-8-2
No i have already formulated the equ. of motion thats why i m able to write mass and stiffness matrix
than i found natural frequencies and modes also
then as we know that response of system is summation of natural modes so i have derived x(t) from this i can find displacement of all the masses with respect to time.
so finally i want the displacements of all the masses (to find out the unknowns i have also given initial conditions )
if u have any other idea to get the response curve please suggest me or else help me to find out those displacement equations.
Walter Roberson
2022-8-2
编辑:Walter Roberson
2022-8-2
%% Intoroduction of variables
syms m k F1 F2 F3 A1 A2 A3 Q1 Q2 Q3 t
%% Value submission
m=1;
k=1;
% w=1;
%% Mass, Stiffness AND Force matrices
M=[m 0 0
0 m 0
0 0 m];
K = [2*k -k 0
-k 2*k -k
0 -k k] ;
%% Equation of motion
format short
[U,w2] = eig(K,M)
U = 3×3
-0.3280 0.7370 -0.5910
-0.5910 0.3280 0.7370
-0.7370 -0.5910 -0.3280
w2 = 3×3
0.1981 0 0
0 1.5550 0
0 0 3.2470
%% Response of the system (here A and Q shows the amplitude and phase difference)
format short
for i = 1:1:3
x{i} = U(i,1)*A1*cos(w2(1,1)*t+Q1) + U(i,2)*A2*cos(w2(2,2)*t+Q2) +U(i,3)*A3*cos(w2(3,3)*t+Q3);
v{i} = diff(x{i}, t);
end
x
x = 1×3 cell array
{[(6638091741507547*A2*cos(Q2 + (7002908864245409*t)/4503599627370496))/9007199254740992 - (2661668130624679*A3*cos(Q3 + (913943508336349*t)/281474976710656))/4503599627370496 - (5908457496031831*A1*cos(Q1 + (3567972556901945*t)/18014398509481984))/18014398509481984]} {[(2954228748015915*A2*cos(Q2 + (7002908864245409*t)/4503599627370496))/9007199254740992 + (1659522935376887*A3*cos(Q3 + (913943508336349*t)/281474976710656))/2251799813685248 - (332708516328085*A1*cos(Q1 + (3567972556901945*t)/18014398509481984))/562949953421312]} {[- (5323336261249361*A2*cos(Q2 + (7002908864245409*t)/4503599627370496))/9007199254740992 - (2954228748015915*A3*cos(Q3 + (913943508336349*t)/281474976710656))/9007199254740992 - (6638091741507549*A1*cos(Q1 + (3567972556901945*t)/18014398509481984))/9007199254740992]}
v
v = 1×3 cell array
{[(2432614309330170770701412156971*A3*sin(Q3 + (913943508336349*t)/281474976710656))/1267650600228229401496703205376 - (46485951498277445065388233601723*A2*sin(Q2 + (7002908864245409*t)/4503599627370496))/40564819207303340847894502572032 + (21081214199463155606688465811295*A1*sin(Q1 + (3567972556901945*t)/18014398509481984))/324518553658426726783156020576256]} {[(1187094855706169954794794625325*A1*sin(Q1 + (3567972556901945*t)/18014398509481984))/10141204801825835211973625643008 - (1516710213722988286690676565563*A3*sin(Q3 + (913943508336349*t)/281474976710656))/633825300114114700748351602688 - (20688194686489267889392397684235*A2*sin(Q2 + (7002908864245409*t)/4503599627370496))/40564819207303340847894502572032]} {[(37278838691262164489772848433649*A2*sin(Q2 + (7002908864245409*t)/4503599627370496))/40564819207303340847894502572032 + (2699998186389765280096224994335*A3*sin(Q3 + (913943508336349*t)/281474976710656))/2535301200456458802993406410752 + (23684529163896374554619270282805*A1*sin(Q1 + (3567972556901945*t)/18014398509481984))/162259276829213363391578010288128]}
Xo = [1 0 0];
Vo = [0 0 0];
% eqns = [x(1,1) == Xo(1,1) , x(1,2) == Xo(1,2), x(1,3) == Xo(1,3), v(1,1) == Vo(1,1) , v(1,2) == Vo(1,2), v(1,3) == Vo(1,3)];
eqns = [x{1} == Xo(1,1) , x{2} == Xo(1,2), x{3} == Xo(1,3), v{1} == Vo(1,1) , v{2} == Vo(1,2), v{3} == Vo(1,3)];
sol = solve(eqns, [A1 A2 A3 Q1 Q2 Q3])
sol = struct with fields:
A1: [8×1 sym]
A2: [8×1 sym]
A3: [8×1 sym]
Q1: [8×1 sym]
Q2: [8×1 sym]
Q3: [8×1 sym]
cross_check = subs(lhs(eqns) - rhs(eqns), sol)
cross_check =

structfun(@(S)disp(vpa(S,10)), sol)






Remember that when you use diff() and you do not specify which variable to take the derivative, that MATLAB chooses a variable for you.
Also remember that you are trying to vpasolve() 8 equations in 9 variables (with t being the extra variable)
Sam Chak
2022-8-2
Okay, @Rahul Jangid. Thanks for your clarification. You want to find the solutions for
so that you can plot
. What do the 8 sets of
tell you? How would you choose a unique set of solution?



更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)