Solving an equation in Matlab
1 view (last 30 days)
Show older comments
Pablo Estuardo
on 12 Feb 2020
Commented: Star Strider
on 13 Feb 2020
Dear, I'm trying to resolve this equation for my thesis project, u and v are the values that I try to calculate, the only parameter that change is the Tx and Ty, all the other parameters are constant. I appreciate any help
tx = [0.1 0.5 0.12 0.14 0.22 0.1 0.12 0.29]
ty = [0.4 0.12 0.34 0.14 0.13 0.03 0.2 0.13]
Omega = 7.3E-5;
latitude = -12;
f0 = 2*Omega*sind(latitude);
r = 1./(2.*24.*3600)
Hm = 25
rho = 1.025e3
dvdt0 = -r.*v0 - f0.*u0 -ty./(rho.*Hm);
dudt0 = -r.*u0 + f0.*v0 + tx./(rho.*Hm);
0 Comments
Accepted Answer
Star Strider
on 12 Feb 2020
These have analytic solutions:
syms u(t) v(t) f taux tauy Hm rho R u0 v0
du = diff(u);
dv = diff(v);
DE = [du - f*v == taux/(Hm*rho) - R*u; dv - f*u == taux/(Hm*rho) - R*v]
Soln = dsolve(DE, u(0)==u0, v(0)==v0)
u_Soln = Soln.u;
v_Soln = Soln.v;
u_Soln = simplify(u_Soln, 'Steps',500)
v_Soln = simplify(v_Soln, 'Steps',500)
u_fcn = matlabFunction(u_Soln)
v_fcn = matlabFunction(v_Soln)
Note that ‘u_fcn’ and ‘v_fcn’ are anonymous functions you can use outside of the Symbolic Math Toolbox.
10 Comments
More Answers (0)
See Also
Categories
Find more on Numbers and Precision in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!