Two variable function computation
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I am trying to reproduce the Matlab plot I found in a research paper. The function in P(t,z) (it is time and space dependent). P(t,z) have two parameters (alpha and beta) which are frequency dependent.
I have two loops for computing P(t,z). My code is below, however, I can't find a similar solution which what is mentioned. This is my code
clc
clear all
close all
f=linspace(0,20*10^6,100);
t=1./f;
x=linspace(0,0.15*10^-2,100);
alpha=(0.45*10^-11)*f.^2;
beta=(0.15*10^-4)*f;
figure(1)
subplot(2,1,1)
plot(f/10^6,alpha/100)
ylabel('alpha')
subplot(2,1,2)
plot(f/10^6,beta/100)
ylabel('beta')
p = zeros(length(x),length(t));
for it= 1:length(t)
for ix=1:length(x)
p(ix,it)= exp(-alpha(it).*x(ix)).*exp(-i.*1.*(f(it).*t(it)-beta(it).*t(it)));
end
end
figure(2)
plot3(x,t,p)
Any help will be appriciated.
Thanks
2 comentarios
Walter Roberson
el 31 de En. de 2017
Note that your p is complex, so you should abs() before plotting the magnitude.
You are changing alpha and omega and beta over time, which is not part of the formula. That p formula is for some particular alpha and beta and omega.
Your definition of t is non-linear, but the plot on the right appears to use linear time.
In the right hand plot, the Distance does not appear to have a scaling factor, but you have used 10^-2 scaling factor in your definition of x.
Respuestas (2)
Walter Roberson
el 31 de En. de 2017
Your expression just does not act like that, at least not over those parameter ranges.
See attached that explores a number of possibilities. (Note the vectorized implementations of the equations.) I put up several isosurface plots to explore the way the surface grows along the 4 different parameters. The last couple of plots explore the possibility that your x is too small or too large. The last one does suggest that possibly the x range should be much smaller; for example if you were to use x/200 then it would have room for only one peak.
On the isosurface plots notice that I plot the real component of p rather than the absolute magnitude. The absolute magnitude are completely boring; plotting the real component at least allows you to track through a couple of phase cycles.
0 comentarios
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!