how to add two loops

2 views (last 30 days)
phoenix
phoenix on 10 Sep 2017
Commented: Andrei Bobrov on 10 Sep 2017
how to write this in matlab. c=x+y; where x=p^2*e^j*p and y=q*e^(-j*q); p,q ranges from 1:1:k.

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 10 Sep 2017
t = 1:k;
c = t.^2.*exp(1i*t) + t.*exp(-1i*t);
  1 Comment
Andrei Bobrov
Andrei Bobrov on 10 Sep 2017
t = 1:k;
p=(2*t.^2+t+1)';
q=(2*t.^2+3*t+2)';
c = p.^2.*exp(1i*p) + q.*exp(-1i*q);

Sign in to comment.

More Answers (1)

KSSV
KSSV on 10 Sep 2017
p=1:1:k;
q=p;
x=p.^2*exp(j*p);
y=q.*exp(-j*q);
c=x+y;
  1 Comment
phoenix
phoenix on 10 Sep 2017
dont i need any loop here?

Sign in to comment.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!