i want to write equation in matlab
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tlotlo Oepeng
el 25 de Abr. de 2021
Respondida: Walter Roberson
el 25 de Abr. de 2021
% ampiltude
function[sign]=amplitude(t,x,y)
sign = 2*A(x^2+y^2)*exp(-0.5*((r/p)^2+(t/T)^2));
end
% function
% theta
Theta = @(x,y)atan(y/x);
K=1;
U_txy = Amp(t+T/2,x,y)*exp(iS*Theta)*exp(i*K*t)+Amp(t-T/2,x,y)*exp(iS*Theta)*exp(-i*K*t);
i want to write the above eqautions in matlab.that is my atempt. code wont run. doubt its ok. the function is suspose to be the amplitude, sign.
0 comentarios
Respuesta aceptada
Walter Roberson
el 25 de Abr. de 2021
format long g
x = randn, y = randn, t = 1.2;
U(x,y,t)
function U_txy = U(x,y,t) %need this in order to have shared constants
K = 1;
A = 7;
rho = 0.3;
t0 = 0.81;
tau = 1.28;
S = -2.16;
Theta = @(x,y)atan2(y,x);
r = reshape(sqrt(x.^2+y.^2), [], 1);
th = reshape(Theta(x,y), [], 1);
U_txy = amplitude(r,t+t0/2).*exp(1i.*S.*th).*exp(1i*K*t) + ...
amplitude(r,t-t0/2).*exp(1i.*S.*th).*exp(-1i*K*t).*exp(1i.*th.*[-1 1]);
% amplitude
function sign = amplitude(r,t)
sign = A .* r.^abs(S) .*exp(-0.5*((r./rho).^2 + (t./tau).^2));
end
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Price and Analyze Financial Instruments 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!