Pspice Problem - How do I take Logarithm_10 in a frequency domain?

In summary, when working with FFTs, it is important to apply the logarithm to the FFT magnitude data rather than the time domain signal to obtain the correct logarithmic scale in frequency domain.
  • #1
NexusN
29
0

Homework Statement



I am simply simulation using a small circuit consisting of a square wave generator, a resistor and a GND.
The Voltage varies from 0 to 0.5V and the frequency is 100kHz for the sig-gen.
I can simulate and output the transient response, a square wave with the above parameter.
The next step I am doing is to apply a fft, that was achieved by using the function of the simulation window: Trace-->Fourier.
Then I set the x-axis(to Log scale, ranged 50k to 30MHz) and everything goes as it should, until I start to apply some formula on the variable V(IN) in order to take log of the amplitude of the harmonic.

test.PNG


Homework Equations



That is, modifying V(IN) to LOG10(V(IN)).
But the obtained values are not correct at all.
On investigating, it seems the log is taken on the transient signal and it is no longer a logarithm after Fourier transforming the signal.

The Attempt at a Solution



I tried to search for the solution of how should the formula be in time domain so that I am taking a log in frequency domain but no luck.

Would you please sharing with me some ideas on this?
Thank you.
 
Physics news on Phys.org
  • #2


Dear forum post author,

Thank you for sharing your simulation work with us. It seems like you are on the right track in terms of setting up the simulation and obtaining the transient response and FFT. However, I can see why you are having trouble with the logarithm of the amplitude after Fourier transforming the signal. This is because the Fourier transform is a linear operation, meaning that it does not preserve the logarithmic scale of the amplitude.

To obtain the correct logarithmic scale in frequency domain, you will need to take the logarithm of the FFT magnitude, rather than the time domain signal. This can be achieved by using a logarithmic scaling function in your simulation software, or by applying a logarithm function to the FFT magnitude data after obtaining it.

I hope this helps and good luck with your simulation work!
 

1. How do I take Logarithm_10 in a frequency domain?

The logarithm_10 function in Pspice can be performed in two ways: using the "lg10" expression or using the "log10" function. Both methods will give the same result. To use the "lg10" expression, simply type "lg10(variable)" where variable is the value you want to take the logarithm of. To use the "log10" function, type "log10(variable)" where variable is the value you want to take the logarithm of. Both methods will return the base 10 logarithm of the given variable.

2. Can I take the logarithm of complex numbers in Pspice?

Yes, Pspice allows you to take the logarithm of complex numbers in the frequency domain. You can use the same methods mentioned in the previous question to take the logarithm of complex numbers. However, the result will also be a complex number with both real and imaginary components.

3. What is the difference between logarithm_10 and natural logarithm in Pspice?

Logarithm_10 is the base 10 logarithm function while the natural logarithm uses the base e (Euler's number). In Pspice, the natural logarithm function is denoted as "ln" and can be used to calculate the logarithm of a variable in the frequency domain. The choice between which logarithmic function to use depends on your specific needs and the context of your problem.

4. Can I take the logarithm of negative numbers in Pspice?

Yes, Pspice allows you to take the logarithm of negative numbers in the frequency domain. However, the result will be a complex number with an imaginary component. This is because the logarithm of a negative number is a complex number. If you are working with negative numbers, make sure to use the complex number format in Pspice to get accurate results.

5. How do I display the logarithm function in Pspice output?

In order to display the logarithm function in Pspice output, you need to use the plot function. You can plot the result of the logarithm function by typing "plot(log10(variable))" or "plot(lg10(variable))" in the output window. This will generate a graph of the base 10 logarithm of the given variable. You can also plot the natural logarithm by typing "plot(ln(variable))" in the output window.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
687
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
Replies
4
Views
2K
  • Electromagnetism
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
5K
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
938
  • Engineering and Comp Sci Homework Help
Replies
4
Views
10K
Back
Top