Need Help implementing an equation
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!