Multiplication of envelope function to that of sine wave
5 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am trying to multiply a base sine wave to that of a square wave and this square wave should act as an switch i,e if there is amplitude 1 then the sine should be present else 0,
t = 0:1e-4:0.1;
x = (1+square(4*pi*50*t)).*sin(2*pi*1000*t); %carrier frequency is 1khz and modulation frequency is 50hz
plot(t,x)
my question is I want different duration for both square function which is acting as an envelope and sine function which is the base and should be modified according to the envelope, but when I try to do it with two different durations it is giving me a matrix mismatch.
t = 0:1e-4:0.1;
ts = 0:1e-4:0.4
T = [t ts]
x = (1+square(4*pi*50*t).*sin(2*pi*1000*ts); %carrier frequency is 1khz and modulation frequency is 50hz
plot(T,x)
Thank you.
0 件のコメント
採用された回答
Star Strider
2021 年 5 月 12 日
I would just use the same value (either ‘t’ or ‘ts’) for both —
t = 0:1e-4:0.1;
ts = 0:1e-4:0.4;
T = [t ts];
x = (1+square(4*pi*50*t).*sin(2*pi*1000*t)); %carrier frequency is 1khz and modulation frequency is 50hz
figure
plot(t,x)
xlim([0 0.02]) % Zoom For Detail (Optional)
It would be possible to use both, however it would then be necessary to create a matrix of them, and that could be difficult to represent, for example —
x = (1+square(4*pi*50*t.')*sin(2*pi*1000*ts)); %carrier frequency is 1khz and modulation frequency is 50hz
figure
surf(ts, t, x)
grid on
xlabel('ts')
ylabel('t')
axis([0 0.025 0 0.00025 zlim]) % Zoom For Detail (Optional)
figure
surf(ts, t, x, 'EdgeColor','none')
grid on
xlabel('ts')
ylabel('t')
.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Visualization and Data Export についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


