Filter löschen
Filter löschen

Need Help implementing an equation

1 Ansicht (letzte 30 Tage)
Rohan Repale
Rohan Repale am 28 Mär. 2013
HI, I intend to implement this equation .....
f(x)=[(1/N)*rect(x/a)]*{summation n=1->N [sin(k(n).*x)]}
where, N = 22; x = x1i1+x2i2 (1i,i2 are unit vectors in x and y direction and x1,x2 are x,y coordinates)
Now, I have implemented the equation 70 %, can some one validate if I have been doing right, plus suggest how should I go ahead.
clear all; close all;
x1 = [-50:50]
x2 = [-50:50]
k1 = [550:22:1012]
k2 = [550:22:1012]
b = zeros(2, 101);
for m = 1:101,
p=0
for n = 1:22
k = [k1(n),k2(n)]
x = [x1(m),x2(m)]
p = p+sin(k.*x)
mx=hypot(x1,x2)
end
b(:,m) = p
rect=@(mx,a) ones(1,numel(x)).*(abs(x)<a/2) % Rect Function
q=rect(mx,50)
end

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by