x1 = cos(2*pi*4*t); , x2 = cos(2*pi*12*t), x3 = cos(2*pi*16*t), x4 = cos(2*pi*28*t) Plot the continuous-time waveforms x1(t), x2(t), x3(t) and x4(t) over a 1-second interval

조회 수: 10 (최근 30일)
HIWOT
HIWOT 2023년 1월 31일
편집: Voss 2023년 1월 31일
t1 % how can i assign my time
x1 = cos(2*pi*4*t1);
x2 = cos(2*pi*12*t1);
x3 = cos(2*pi*16*t1);
x4 = cos(2*pi*28*t1);
subplot(2,2,1); % select the 1st out of 4 subplots
plot(t1,x1); % plot a CT signal x1
grid on; % turn on the grid
xlabel('time (t)'); % Label the x-axis as time
ylabel('cos(2*pi*4*t)');% Label the y-axis
title('Graph of x1'); % Insert the title
subplot(2,2,2); % select the 2nd out of 4 subplots
plot(t1,x2); % plot a CT signal x2
grid on; % turn on the grid
xlabel('time (t)'); % Label the x-axis as time
ylabel('cos(2*pi*12*t)');% Label the y-axis
title('Graph of x2'); % Insert the title
subplot(2,2,3); % select the 3rd out of 4 subplots
plot(t1,x2); % plot a CT signal x3
grid on; % turn on the grid
xlabel('time (t)'); % Label the x-axis as time
ylabel('cos(2*pi*16*t)');% Label the y-axis
title('Graph of x3'); % Insert the title
subplot(2,2,4); % select the 4th out of 4 subplots
plot(t1,x2); % plot a CT signal x3
grid on; % turn on the grid
xlabel('time (t)'); % Label the x-axis as time
ylabel('cos(2*pi*28*t)');% Label the y-axis
title('Graph of x4'); % Insert the title

답변 (1개)

Voss
Voss 2023년 1월 31일
t1 = linspace(start_time,end_time,number_of_samples)
For example, to use 100 samples over a one-second interval starting at t = 0:
t1 = linspace(0,1,100);
Then the rest can be like you have it already:
x1 = cos(2*pi*4*t1);
x2 = cos(2*pi*12*t1);
x3 = cos(2*pi*16*t1);
x4 = cos(2*pi*28*t1);
subplot(2,2,1); % select the 1st out of 4 subplots
plot(t1,x1); % plot a CT signal x1
grid on; % turn on the grid
xlabel('time (t)'); % Label the x-axis as time
ylabel('cos(2*pi*4*t)');% Label the y-axis
title('Graph of x1'); % Insert the title
subplot(2,2,2); % select the 2nd out of 4 subplots
plot(t1,x2); % plot a CT signal x2
grid on; % turn on the grid
xlabel('time (t)'); % Label the x-axis as time
ylabel('cos(2*pi*12*t)');% Label the y-axis
title('Graph of x2'); % Insert the title
subplot(2,2,3); % select the 3rd out of 4 subplots
plot(t1,x2); % plot a CT signal x3
grid on; % turn on the grid
xlabel('time (t)'); % Label the x-axis as time
ylabel('cos(2*pi*16*t)');% Label the y-axis
title('Graph of x3'); % Insert the title
subplot(2,2,4); % select the 4th out of 4 subplots
plot(t1,x2); % plot a CT signal x3
grid on; % turn on the grid
xlabel('time (t)'); % Label the x-axis as time
ylabel('cos(2*pi*28*t)');% Label the y-axis
title('Graph of x4'); % Insert the title

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by