Very simple simultaneous eqs.
    1 Ansicht (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
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 Kommentare
Antworten (1)
  Sean de Wolski
      
      
 am 8 Aug. 2011
        doc subs  %substitute numerical values
doc double  %convert symbolic to double precision
2 Kommentare
  Sean de Wolski
      
      
 am 8 Aug. 2011
				Use SUBS to substitute your values for D1 D2 c et al. into the s.x,s.y symbolics.
Siehe auch
Kategorien
				Mehr zu Symbolic Math Toolbox 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!