How to write a code for the following?

1 次查看(过去 30 天)
I have two vectors u=[u1 u2 u3 u4]=[1 2 3 4]; and b=[b1 b2 b3 b4]=[1 2 3 4];
For M=4 and N=3, I want a to get a row vector xo of size 1 x M+N-1 such that the general equations for the last two elements of that vector xo are:
x2ndlast=exp(-jpi(N-1)Mcos(u1))+exp(-jpi(N-1)Mcos(u2))+......+exp(-jpi(N-1)Mcos(last element of u))
xLast= exp(-jpi(M-1)Ncos(u1))+exp(-jpi(M-1)Ncos(u2))+......+exp(-jpi(M-1)Ncos(last element of u))
Likewise, I want to get another row vector xe of same size 1 x M+N-1 such that the general equations for the last two elements of that vector xe are:
x2ndlast=exp(-jpi(N-1)Mcos(b1))+exp(-jpi(N-1)Mcos(b2))+......+exp(-jpi(N-1)Mcos(last element of b))
xLast= exp(-jpi(M-1)Ncos(b1))+exp(-jpi(M-1)Ncos(b2))+......+exp(-jpi(M-1)Ncos(last element of b))
Then sum all element of xo in xo. Likewise, sum all elements of xe in xe. Then find
abc=0.0;
for m1=1:M+N-1
abc=abc+(abs(xo(1,m1)-xe(1,m1))).^2; %This is error1.
end
abc=abc/M+N-1;

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by