MATLAB Answers

why this is Index exceeds matrix dimensions?

1 view (last 30 days)
Muhammad Fikri
Muhammad Fikri on 1 Jun 2020
Edited: KALYAN ACHARJYA on 1 Jun 2020
Vc = 2
Vm = 1.5
fc = 100
fm = 10
ts= 1/1000
n = 0:99
t = ts*n
vc = Vc*cos(2*pi*fc*t);
vm = Vm*cos(2*pi*fm*t);
vam = Vc*cos(2*pi*fc*t)+(Vm/2)*cos(2*pi(fc-fm)*t)-(Vm/2)*cos (2*pi(fc+fm)*t);

  0 Comments

Sign in to comment.

Answers (2)

KALYAN ACHARJYA
KALYAN ACHARJYA on 1 Jun 2020
Edited: KALYAN ACHARJYA on 1 Jun 2020
Vc = 2;
Vm = 1.5;
fc = 100;
fm = 10;
ts= 1/1000;
n = 0:99;
t = ts*n;
vc = Vc*cos(2*pi*fc*t);
vm = Vm*cos(2*pi*fm*t);
vam = Vc*cos(2*pi*fc*t)+(Vm/2)*cos(2*pi*(fc-fm)*t)-(Vm/2)*cos (2*pi*(fc+fm)*t)
%......................................^...........................^

  0 Comments

Sign in to comment.


KSSV
KSSV on 1 Jun 2020
Edited: KSSV on 1 Jun 2020
Note this step:
cos(2*pi(fc-fm)*t)
There * is missing pi and (fc-fp)
Change that one to
cos(2*pi*(fc-fm)*t)
Vc = 2 ;
Vm = 1.5 ;
fc = 100 ;
fm = 10 ;
ts= 1/1000 ;
n = 0:99 ;
t = ts*n ;
vc = Vc*cos(2*pi*fc*t);
vm = Vm*cos(2*pi*fm*t);
vam = Vc.*cos(2*pi*fc*t)+(Vm/2).*cos(2*pi*(fc-fm)*t)-(Vm/2).*cos (2*pi*(fc+fm)*t);

  1 Comment

madhan ravi
madhan ravi on 1 Jun 2020
Note: * is enough for scalar multiplication.

Sign in to comment.


Translated by