Soundwaves underwater problem not working correctly
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi!
I have a question regarding problem 7 in the attached document.
I have looked at some of the other posts regarding this question and I have a code which is functioning quite well but I am curious about one thing. In the question they state that the value of z(xf) should be 2500 feet. I do get a nice wave function however after 25 nautical miles the value is more like 2170 feet.
This is my code:
function dZ = undervatten(x,Z)
p=[5.8795547370783 14.4873921534832 257.1922990416989]; %values of p(1,2,3)
c=@(z) 4800+p(1)+((p(2))*z/1000)+((p(3))*exp(-z/1000));
c=c(2000);
q0=(c/cosd(7.8));
dZ=zeros(2,1);
dZ(1)=Z(2);
dZ(2)=-q0^2*(((-p(3)/1000)*exp(-Z(1)/1000))+p(2)/1000)/((4800+p(1)+(p(2)*Z(1)/1000)+(p(3)*exp(-Z(1)/1000))^3));
end
The values of p I got by using the method of least squares and I am fairly certain that they are correct, however I could be wrong.
Then in another document I run the following:
clear all, close all, clc
n=7.8
[X,Z]=ode45(@undervatten,[0:6076*25],[2000 tand(n)]);
plot(X(151700:end),Z(151700:end,1),'-r')
So I have plotted just the last feet that this ray is moving until it is picked up by the reciever. But as you can see, I am not getting the value 2500 feet as the assignment states that I should. What have I done wrong with my code?
Thanks in advance.
2 comentarios
Jan
el 8 de Nov. de 2016
Are you sure that your professor agrees with the publication of the PDF? He owns the copy right.
You can assume, that most of the users of this forum are frightend by a 24 pages pdf with Swedish head lines.
The purpose of
c=@(z) 4800+p(1)+((p(2))*z/1000)+((p(3))*exp(-z/1000));
c=c(2000);
is not clear. Why do you create an anonymous function only to overwrite it in the following line?
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!