Need help to form equations
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Sameer
am 6 Jun. 2014
Bearbeitet: Sameer
am 6 Jun. 2014
Hello all
I want to form the equations through the matlab commands,I have the matrix of constants....Can anyone guide how can I form the equations. Example equations
1) a1v1^2-a2v2-a3v3^2-a4v4=0
2) a3v3^2-a4v4-a1v1=0
3) a1v1+a4v4-a3v3^2=0
4) a2v2+a1v1+a3v3-a4v4=0
where a's are constant and I have a matrix for a and I have to find v's.
I want to use them in fsolve.
please guide!!!
Regards
0 Kommentare
Akzeptierte Antwort
David Sanchez
am 6 Jun. 2014
a = rand(1,4); % your a matrix
syms v1 v2 v3 v4
S = solve( a(1)*v1^2-a(2)*v2-a(3)*v3^2-a(4)*v4==0,...
a(3)*v3^2-a(4)*v4-a(1)*v1==0,...
a(1)*v1+a(4)*v4-a(3)*v3^2==0,...
a(2)*v2+a(1)*v1+a(3)*v3-a(4)*v4==0)
S =
v1: [4x1 sym]
v2: [4x1 sym]
v3: [4x1 sym]
v4: [4x1 sym]
To display the solutions, access the elements of the structure array S
S.v1
ans =
0
0.76082746713182598996024745838092
- 0.38041373356591299498012372919046 - 0.65889591443313132581875790778993*i
- 0.38041373356591299498012372919046 + 0.65889591443313132581875790778993*i
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!