Thread Subject: Frequency Modulated Signal

Subject: Frequency Modulated Signal

From: Simon Luk

Date: 4 Jun, 2009 05:22:01

Message: 1 of 3

Hi All,

I am trying to perform frequency modulation on a signal, but unfortunately I do not know what I'm doing wrong. Below is my code.

Red is the message signal
Blue is the modulated signal


clear all
close all
ts=1/300000; % sampling interval
fc=50000; % carrier frequency
fs=1/ts; % sampling frequency
fm = 2000;
t=[0:ts:0.002]; % time vector
kf=2000; % deviation constant
m=cos(2*pi*fm*t); % the message signal

int_m(1)=0;
for i=1:length(t)-1 % integral of m
  int_m(i+1)=int_m(i)+m(i);
end

mod_signal(1) = cos(2*pi*fc*ts+2*pi*kf*ts*int_m(1));
for i=1:length(t)-1
    mod_signal(i+1) = cos(2*pi*fc*i*ts+2*pi*kf*ts*int_m(i));
end
    

plot(t,m(1:length(t)))
hold on;
plot(t,mod_signal(1:length(t)), 'r')
xlabel('Time')


Someone able to tell me what is wrong? My modulated signal doesn't seem to be correct I dont think.

Thanks.

Regards,
Simon

Subject: Frequency Modulated Signal

From: Wayne King

Date: 4 Jun, 2009 12:25:02

Message: 2 of 3

Hi Simon, why not use modulate() with the pm or fm option, depending on what you want?

wayne

"Simon Luk" <simon.luk@student.uts.edu.au.REMOVETHIS> wrote in message <h07llp$rvk$1@fred.mathworks.com>...
> Hi All,
>
> I am trying to perform frequency modulation on a signal, but unfortunately I do not know what I'm doing wrong. Below is my code.
>
> Red is the message signal
> Blue is the modulated signal
>
>
> clear all
> close all
> ts=1/300000; % sampling interval
> fc=50000; % carrier frequency
> fs=1/ts; % sampling frequency
> fm = 2000;
> t=[0:ts:0.002]; % time vector
> kf=2000; % deviation constant
> m=cos(2*pi*fm*t); % the message signal
>
> int_m(1)=0;
> for i=1:length(t)-1 % integral of m
> int_m(i+1)=int_m(i)+m(i);
> end
>
> mod_signal(1) = cos(2*pi*fc*ts+2*pi*kf*ts*int_m(1));
> for i=1:length(t)-1
> mod_signal(i+1) = cos(2*pi*fc*i*ts+2*pi*kf*ts*int_m(i));
> end
>
>
> plot(t,m(1:length(t)))
> hold on;
> plot(t,mod_signal(1:length(t)), 'r')
> xlabel('Time')
>
>
> Someone able to tell me what is wrong? My modulated signal doesn't seem to be correct I dont think.
>
> Thanks.
>
> Regards,
> Simon

Subject: Frequency Modulated Signal

From: Simon Luk

Date: 4 Jun, 2009 12:44:02

Message: 3 of 3

Hi Wayne,

I could but that kinda defeats the purpose of frequency modulation... i want to show my students in the tutorial the actual thin happening.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com