Fourier series in Multisim

Thread Starter

xxxyyyba

Joined Aug 7, 2012
289
Is it possible to represent some signal in terms of Fourier series in Multisim? For example, Fourier series of sawtooth voltage with period T=2pi is
\(\sum_{n=1}^{\infty }\frac{2}{n}(-1)^{n+1}sin{(nt)}=2sin{(t)}-sin{(2t)}+\frac{2}{3}sin{(3t)}-\frac{1}{2}sin{(4t)}+...\)
These terms on right side of equation will be AC voltage sources connected in series. For good approximation of sawtooth waveform I should use few hundreds terms of series. It would be impossible to connect all these sources manually :) Is there any better way to do this?
 
Last edited:

Thread Starter

xxxyyyba

Joined Aug 7, 2012
289
I want to see how it works in electrical circuit :) Multisim had already sawtooth generator so it would be easier to use it directly instead of using Fourier representation of sawtooth signal but I used sawtooth signal just as an example. Actually, I was wondering is it possible to simulate random periodic signal which can be represented through Fourier series in Multisim in order to calculate, for example, current in some branch or some voltage.
 

Thread Starter

xxxyyyba

Joined Aug 7, 2012
289
For example, how can I simulate this circuit if input voltage is

\(E(t)=1+\sum_{n=1}^{\infty}\frac{2(-1)^{n}}{\sqrt{n^{2}+1}}\cos({nt+\arctan{n}})\)

kolo.jpg
 

shteii01

Joined Feb 19, 2010
4,644
Circuit simulator simulates circuit.

Circuit simulator DOES NOT simulate equation.

That is why we have MatLab and other mathematical software.
 

Thread Starter

xxxyyyba

Joined Aug 7, 2012
289
Here is Fourier series of sawtooth waveform with 2pi period:
\(e(t)=\sum_{n=1}^{\infty}\frac{2(-1)^{n+1}}{n}\sin{(nt)}\)

I wrote program in Matlab to plot it:

clear
clc
t=linspace(0,2*pi,1000);
suma=0;
for n=1:10000
suma=suma+((2./n).*(-1).^(n+1)).*sin(n.*t);
end
plot(t,suma)
grid

Can I link it somehow with Simulink to generate this waveform as an electrical signal?
 
Last edited:

t_n_k

Joined Mar 6, 2009
5,455
I suppose I have a different perspective on what a circuit simulator does. It essentially solves mathematical relationships with circuit laws providing the necessary constraints and boundary conditions.
I see no reason why in principle a simulator can not have a block element with a defined mathematical output. An infinite series simulation is a problem but one can envisage a truncated approximation which might provide certain insights.
A circuit simulator I regularly use has a circuit block element which can produce an arbitrary time dependent output defined by a mathematical function of my choosing. So if I had the patience I could enter a partial or truncated Fourier series for a sawtooth waveform as the source output definition.
An interesting observation, for instance, might be the Gibbs phenomenon.
 
Last edited:

Thread Starter

xxxyyyba

Joined Aug 7, 2012
289
Which circuit simulator do you use? :)
ABM source in Multisim unfortunatelly doesn't support sumation. It is necessary to use few thousands of terms (see my code) for excellent approximation of sawtooth signal. There is maybe some simulator which can sum all these terms and produce signal. I used sawtooth signal as example, some other signal maybe doesn't need such big number of terms for good approximation .
 

Thread Starter

xxxyyyba

Joined Aug 7, 2012
289
Finally I solved it!
In order to simulate arbitrary periodic signal written in terms of Fourier series, it is necessary to calculate sum using my code for example (it's for sawtooth waveform), post #9 . For every value of t we have appropriate value of "suma". Then we have to save our data in text file, time goes in first column and values for "suma" goes in second column. Then we load our text file in PWL Voltage in Multisim (Enter data points int table - Initialize from file...) and that's it :)
 
Last edited:
Top