why matlab can't plot signals ?

조회 수: 6 (최근 30일)
Mohamed
Mohamed 2024년 1월 6일
댓글: Dyuman Joshi 2024년 1월 6일
clc;
clear all;
close all;
Fc= input(' Carrier frequency = ');
Fm= input(' message frequency = ');
Am=input('Message signal amplitude = ');
Ac=input('Carrier signal amplitude = ');
B=input('Modulation index = ');
t=0: 0.0001;0.1;
C_t= Ac*cos(2*pi*Fc*t);
subplot(3,1,1);
plot(t,C_t);
ylabel('amplitude');xlabel('time index');title('Carrier signal');
M_t= Am*sin(2*pi*Fm*t);
subplot(3,1,2);
plot(t,M_t);
ylabel('amplitude');xlabel('time index');title('Modulating signal');
S_t = Ac*cos((2*pi*Fc*t)+ B*cos(2*pi*Fm*t));
subplot(3,1,3);
plot(t,S_t);
ylabel('amplitude');xlabel('time index');title('Frequency Modulated signal');

채택된 답변

Dyuman Joshi
Dyuman Joshi 2024년 1월 6일
편집: Dyuman Joshi 2024년 1월 6일
Because there's a typo, semi-colon instead of colon in defining t.
% v
t=0: 0.0001;0.1;
t
t = 0
t here is a scalar, which when you supplied to plot() without specifying a marker does not result in a plot.
Fix the typo and your code will work as expected.
  댓글 수: 2
Mohamed
Mohamed 2024년 1월 6일
thanks mate
Dyuman Joshi
Dyuman Joshi 2024년 1월 6일
You're welcome!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

madhan ravi
madhan ravi 2024년 1월 6일
t = 0 : 0.0001 : 0.1;
% ^

카테고리

Help CenterFile Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by