FM Signal in matlab
80 次查看(过去 30 天)
显示 更早的评论
Hi guys, I wish to get help on 3 things
- How to set border for the graph?
- How to set only 2 cycle in the result?( means instead of many cycle,I want to have only 2 cycle every time when we key in user input)
- How to change from time domain to frequency domain?
%FM generation
clc;
clear all;
close all;
fc=input('Enter the carrier signal freq in hz,fc=');
fm=input('Enter the modulating signal freq in hz,fm =');
m=input('Modulation index,m= ');
t=0:0.0001:0.1;
c=cos(2*pi*fc*t);%carrier signal
M=sin(2*pi*fm*t);% modulating signal
subplot(3,1,1);plot(t,c);
ylabel('amplitude');xlabel('time index');title('Carrier signal');
subplot(3,1,2);plot(t,M);
ylabel('amplitude');xlabel('time index');title('Modulating signal');
y=cos(2*pi*fc*t-(m.*cos(2*pi*fm*t)));
subplot(3,1,3);plot(t,y);
ylabel('amplitude');xlabel('time index');title('Frequency Modulated signal');
fs=10000;
p=fmdemod(y,fc,fs,(fc-fm));
figure;
subplot(1,1,1);plot(p);
3 个评论
采纳的回答
Samyuktha Premkumar
2023-1-8
%FM generation
clc;
clear all;
close all;
fc=input('Enter the carrier signal freq in hz,fc=');
fm=input('Enter the modulating signal freq in hz,fm =');
m=input('Modulation index,m= ');
t=0:0.0001:0.1;
c=cos(2*pi*fc*t);%carrier signal
M=sin(2*pi*fm*t);% modulating signal
subplot(3,1,1);plot(t,c);
ylabel('amplitude');xlabel('time index');title('Carrier signal');
subplot(3,1,2);plot(t,M);
ylabel('amplitude');xlabel('time index');title('Modulating signal');
y=cos(2*pi*fc*t-(m.*cos(2*pi*fm*t)));
subplot(3,1,3);plot(t,y);
ylabel('amplitude');xlabel('time index');title('Frequency Modulated signal');
fs=10000;
p=fmdemod(y,fc,fs,(fc-fm));
figure;
subplot(1,1,1);plot(p);
更多回答(6 个)
ong jia eek
2019-9-29
3 个评论
Walter Roberson
2019-9-30
aliasing. Your modulated signal needs a higher sampling frequency than the base frequency if you want to see non-clipped waveforms.
Mohammad Yar
2021-1-15
%Modulated Signal:
z = ammod(x, fc, fs, 0, Ac);
figure(5);
plot(t(1:1000), z(1:1000));
title('Modulated Signal');
xlabel('time(t)');
ylabel('Amplitude');
%Z=(fft(z));
lfftmz=length(z);
ffmz=fftshift(fft(z));
mfftz=(-lfftmz/2:lfftmz/2-1)/(lfftmz*T);
figure(6);
plot(mfftz,abs(ffmz));
title('frequency domain AM');
*(any one please explaine this code)
0 个评论
Mohammad Yar
2021-1-15
编辑:Walter Roberson
2023-1-8
clc;
close all;
clear all;
h=0.5; fs=1000;
T=1/fs; t=0:T:1;
%Message Signal:
Am = 10;
fm = 10;
x = Am*sin(2*pi*fm*t);
figure;
figure(1);
plot(t, x);
lfftm=length(x);
ffm=fftshift(fft(x));
mfft=(-lfftm/2:lfftm/2-1)/(lfftm*T);
title('Message Signal');
xlabel('time(t)');
ylabel('Amplitude');
%X=fft(x);
figure(2);
plot(mfft,abs(ffm));
title('frequency domain msg');
*(any one please explaine this code)
.
0 个评论
Mohammad Yar
2021-1-15
%Demodulated Signal:
d = amdemod(z, fc, fs, 0, Ac);
figure(7);
plot(t(1:1000), d(1:1000));
title('Demodulated Signal');
xlabel('time(t)');
ylabel('Amplitude');
ylim([-10, 10]);
%D=fft(d);
lfftmd=length(x);
ffmd=fftshift(fft(x));
mfftd=(-lfftmd/2:lfftmd/2-1)/(lfftmd*T);
figure(8);
plot(mfftd,abs(ffmd));
title('frequency domain demodulation');
*(any one please explaine this code)
0 个评论
Mohammad Yar
2021-1-15
%Carrier Signal:
Ac = Am/h; fc = 10*fm;
y = Ac*cos(2*pi*fc*t);
figure(3);
plot(t(1:1000), y(1:1000));
title('Carrier Signal');
xlabel('time(t)');
ylabel('Amplitude');
lfftmy=length(y);
ffmy=fftshift(fft(y));
mffty=(-lfftmy/2:lfftmy/2-1)/(lfftmy*T);
%Y=fft(y); figure(4);
plot(mffty,abs(ffmy));
title('frequency domain carrier');
*(any one please explaine this code)
0 个评论
Mayur Ingle
2022-5-20
clear all;
close all;
fm=input('Enter the modulating signal:');
fc=input('Enter the carrier signal:');
Em=input('Enter the modulating voltage:');
Ec=input('Enter the carrier voltage:');
m=input('Enter the value of modulation index:');
t=0:0.01:10;
A=cos(6.28*fm*t); %mathematical equation of modulating signal
B=cos(6.28*fc*t); %mathematical equation of Carrier signal
C=Ec*cos(6.28*fc*t + m*sin(6.28*fm*t)); %mathematical equation of FM signal
subplot(3,1,1);
plot(t,A);
xlabel('time');
ylabel('Amplitude');
title('Modulating Signal');
subplot(3,1,2);
plot(t,B);
xlabel('time');
ylabel('Amplitude');
title('Carrier Signal');
subplot(3,1,3);
plot(t,C);
xlabel('time');
ylabel('Amplitude');
title('Modulated Signal');
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Modulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!