How can I solve such questions in matlab (fix the error)

t = 0 : 0.0001 : 0.1
fc = 1000;
fo = 50;
fmax = 100;
I have range of |f| as [950, 1050].
And its used in this formula
x = ((f - 50)/2*50) + 1/2
and this is further multiplied with this curve
m = 300*cos(60*pi*t) + 5*cos(160*pi*t);
v = m.*cos(fc*t);
vsb = v.*x;
and then i plot it like this
plot(t, vsb);
but in this i get the error as
`Arrays have incompatible sizes for this operation.`
for this part
vsb = v.*x

 Accepted Answer

f is a different size than t, so x is a different size than v. Define t and f to be the same size and it'll work. Here, I calculate f from t (and fc, fo) - not that this is the right way to do it, just to illustrate the point:
t = 0 : 0.0001 : 0.1;
fc = 1000;
fo = 50;
f = linspace(fc-fo,fc+fo,numel(t));
fmax = 100;
x = ((f - 50)/2*50) + 1/2;
m = 300*cos(60*pi*t) + 5*cos(160*pi*t);
v = m.*cos(fc*t);
vsb = v.*x;
plot(t, vsb);

More Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Products

Release

R2021b

Asked:

on 27 Feb 2022

Commented:

on 27 Feb 2022

Community Treasure Hunt

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

Start Hunting!