Need Help implementing an equation
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!