why this is Index exceeds matrix dimensions?

1 回表示 (過去 30 日間)
Muhammad Fikri
Muhammad Fikri 2020 年 6 月 1 日
編集済み: KALYAN ACHARJYA 2020 年 6 月 1 日
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);

回答 (2 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 6 月 1 日
編集済み: KALYAN ACHARJYA 2020 年 6 月 1 日
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)
%......................................^...........................^

KSSV
KSSV 2020 年 6 月 1 日
編集済み: KSSV 2020 年 6 月 1 日
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 件のコメント
madhan ravi
madhan ravi 2020 年 6 月 1 日
Note: * is enough for scalar multiplication.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by