Very simple simultaneous eqs.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am working on a script to pinpoint acoustic sources from differences in arrival times. This is a very basic question but I'm new to Matlab so hopefully the answer will be very simple. This is what I have done so far.
function timediff
eq1 = '((D1^2-(t1^2)*(c^2))/(t1*c+D1*cos(y-theta1))*0.5)-x';
eq2 = '((D2^2-(t2^2)*(c^2))/(t2*c+D2*cos(theta3-y))*0.5)-x';
s=solve(eq1,eq2)
D1 = input('Enter value of D1: ');
D2 = input('Enter value of D2: ');
c = input('Enter value of speed of sound (c): ');
theta1 = input('Enter value of theta1: ');
theta3 = input('Enter value of theta3: ');
t1 = input('Enter value of time difference 1: ');
t2 = input('Enter value of time difference 2: ');
a=vpa(s.x)
b=vpa(s.y)
plot(a,b,'x')
When I run this and enter the paramaters it calculates a and b but doesn't evaluate them numerically - how do I do this because I would like to be able to plot them on a graph.
Many thanks in advance
0 commentaires
Réponses (1)
Sean de Wolski
le 8 Août 2011
doc subs %substitute numerical values
doc double %convert symbolic to double precision
2 commentaires
Sean de Wolski
le 8 Août 2011
Use SUBS to substitute your values for D1 D2 c et al. into the s.x,s.y symbolics.
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!