# How to write a code for the following?

1 vue (au cours des 30 derniers jours)
Sadiq Akbar le 5 Mar 2021
Modifié(e) : Sadiq Akbar le 5 Mar 2021
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 commentairesAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!