Help with Plotting a Pulse Train as function of time in MATLAB

Hi, the problem statement is listed below I have the values for f,wavelength,duty cycle, amplitude, etc. i would just need to plot the pulse train (from fourier series) as a function of time at the values of x=0 and x=5000. the problem is I have no idea how to do this in MATLAB. nor what it means by function of time, since there's no maximum t value. I tried this in excel but i was even more clueless. i would appreciate any help, thanks.
the fouerier series equation i calculated: http://tinypic.com/r/24v0eft/5

Answers (2)

Start from this version :
f0=1e+6; % 1MHz
Fs=3e+6;
Tf=0.001; % 1 millisecond
t=0:1/Fs:Tf-1/Fs;
td=0.1; % duty cycle
A0=10; % 10 Volts
F=0;
N=1000; % Number of points
for n=1:N
F=F+(1/n)*cos(n*2*pi*f0*t).*sin(n*pi*td);
end
F=F*(2*A0/pi);
F=F+A0*td;
I actually found another topic similar to this online. so i was able to use MATLAB to plot the fourier series, would appreciate if you could verify this is right:
syms n t;
A0=10;f0=1e6;up=3e8;l=up/f0;td=0.1;
x=0;t=0:1*10^-7:5*10^-6;
F_x = (A0*td)+(((2*A0)/pi)*symsum((1/n)*sin(n*pi*td)*cos(n*((2*pi*f0*t)-(((2*pi)/l)*x))), n, 1, 1000));
plot (t,F_x);
grid on;
axis([0 5*10^-6 -5 15]);
hold on;
where I tried plotting it for something like t=5sec, but nothing showed up. then i realized i should find the period (one wave) and plot for a maximum t value of like 5 of these. so i plotted from 0<t<5e-6. also repeated for x=5000

Categories

Find more on Mathematics in Help Center and File Exchange

Asked:

on 4 Sep 2013

Community Treasure Hunt

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

Start Hunting!