Very simple simultaneous eqs.
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Sean de Wolski
2011년 8월 8일
doc subs %substitute numerical values
doc double %convert symbolic to double precision
댓글 수: 2
Sean de Wolski
2011년 8월 8일
Use SUBS to substitute your values for D1 D2 c et al. into the s.x,s.y symbolics.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!