¿ªÔÆÌåÓý

FFT


 

Hello,

I'm taking a periodic time signal from LT_Spice as text file and
I would like to do the interpolation and FFT with Matlab in order to
compare results.
I read the help of Matlab about FFT and vq = interp1 (x, v, xq)
and I tried doing FFT in Matlab, but unfortunately I couldn't get to
You're right.

Can I please tell myself how I can get from text file of Lt_spice in
Matlab FFT?

I would be very grateful for any help.

Thanks


 

Hello,

Years ago I wrote the following in message.

---
There is a command available in Matlab to perform the linear
or some other kind of interpolation.

yi=interp1(x,y,xi,'linear')

x and y are the vectors from the import of the raw-file.
xi is the vector with the x-values having a constant step size.
yi will be calculated at xi.
---

When you have a time window of 1000us and 1000 data-points, your list will start with t=0 and 1us increment. The last data-point have to be at 999us.
That's in principle what I talked about in message #118131 regarding the last data-point for the FFT.

Best regards,
Helmut


 

Dear Mr.?Helmut

thanks for your reply. However, about interpolation I am sure, and it is?
correct.
Unfortunately, I can not take the fft, however I also read your?
mentioned message #118131.
In attachment, (fft_HV.txt) is my code
a = load('C:\Users\Amir\\FFT\fft_HV.txt');

x=a(:,1);


v=a(:,2);

xq = 0:1e-9:10e-6;

% fs=1/dt
figure
grid on
vq1 = interp1(x,v,xq);
plot(x,v,'o',xq,vq1,'-x');
grid on
xlim([0 10e-6]);
title('(Default) Linear Interpolation');
f=100e3;
T=1/f;
L=length(v);
t=(0:L-1)*T;
fft(v)




?I wonder if you please let me know about the?
possible faults.

Or I really wonder if you send me a template code which take fft of an?
arbitrary signal with unknown harmonics.

Best regards


 

?????
? ???? ?? ???? ??ltspicce ??? ?? ????? ?? ?? ???? ???
????? ???? ?? ???? ????
?? ????
On Saturday, December 22, 2018, 11:15:18 PM GMT+3:30, amirghasri_2010@... [LTspice] wrote:


?

Dear Mr.?Helmut

thanks for your reply. However, about interpolation I am sure, and it is?
correct.
Unfortunately, I can not take the fft, however I also read your?
mentioned message #118131.
In attachment, (fft_HV.txt) is my code
a = load('C:\Users\Amir\\FFT\fft_HV.txt');

x=a(:,1);


v=a(:,2);

xq = 0:1e-9:10e-6;

% fs=1/dt
figure
grid on
vq1 = interp1(x,v,xq);
plot(x,v,'o',xq,vq1,'-x');
grid on
xlim([0 10e-6]);
title('(Default) Linear Interpolation');
f=100e3;
T=1/f;
L=length(v);
t=(0:L-1)*T;
fft(v)




?I wonder if you please let me know about the?
possible faults.

Or I really wonder if you send me a template code which take fft of an?
arbitrary signal with unknown harmonics.

Best regards


 


Salam,

daghighan begin mikhaeid chika konid ba ltspice manzor az code chi (Netlist) manzoredone?

Am Sonntag, 23. Dezember 2018, 16:05:01 MEZ hat kamelia noroozi noroozi.kamelia@... [LTspice] Folgendes geschrieben:


?

?????
? ???? ?? ???? ??ltspicce ??? ?? ????? ?? ?? ???? ???
????? ???? ?? ???? ????
?? ????
On Saturday, December 22, 2018, 11:15:18 PM GMT+3:30, amirghasri_2010@... [LTspice] wrote:


?

Dear Mr.?Helmut

thanks for your reply. However, about interpolation I am sure, and it is?
correct.
Unfortunately, I can not take the fft, however I also read your?
mentioned message #118131.
In attachment, (fft_HV.txt) is my code
a = load('C:\Users\Amir\\FFT\fft_HV.txt');

x=a(:,1);


v=a(:,2);

xq = 0:1e-9:10e-6;

% fs=1/dt
figure
grid on
vq1 = interp1(x,v,xq);
plot(x,v,'o',xq,vq1,'-x');
grid on
xlim([0 10e-6]);
title('(Default) Linear Interpolation');
f=100e3;
T=1/f;
L=length(v);
t=(0:L-1)*T;
fft(v)




?I wonder if you please let me know about the?
possible faults.

Or I really wonder if you send me a template code which take fft of an?
arbitrary signal with unknown harmonics.

Best regards


 

kamelia noroozi wrote:

? ? "?????
? ? ?? ???? ?? ???? ??ltspicce ??? ?? ????? ?? ?? ???? ???
? ? ?????? ???? ?? ???? ????
? ? ??? ????"

Please use English only.? This group's language is English, and the group's owner/moderator has said that English must be used.

Translated:

? ? "Hello
? ? ??? ltspicce you know what the code was written so in
? ? ?I'm grateful that you've helped me
? ? ?Thanks"

We don't.? I would guess that it might be more than one.

Except as an intellectual curiosity, it does not matter.

Regards,
Andy



 

¿ªÔÆÌåÓý

The original Berkeley SPICE core was written in Fortran. That core was rewritten for LTspice just a couple of years ago. Whether or not it was maintained in Fortran or ported to some other language its totally unknown. It IS remotely possible that writing to the ¡°contact¡± email address in the LThelp file might give you some hints, but I would not count on it. Mike, the author, has been pretty ¡°tight lipped¡± about such details.

Jim

James Wagner
Oregon Research Electronics




On Dec 23, 2018, at 11:18 AM, Andy ai.egrps@... [LTspice] <LTspice@...> wrote:


kamelia noroozi wrote:

? ? "?????
? ? ?? ???? ?? ???? ??ltspicce ??? ?? ????? ?? ?? ???? ???
? ? ?????? ???? ?? ???? ????
? ? ??? ????"

Please use English only.? This group's language is English, and the group's owner/moderator has said that English must be used.

Translated:

? ? "Hello
? ? ??? ltspicce you know what the code was written so in
? ? ?I'm grateful that you've helped me
? ? ?Thanks"

We don't.? I would guess that it might be more than one.

Except as an intellectual curiosity, it does not matter.

Regards,
Andy





 

Sometimes I have used the (time equidistant) .WAV file format for data interchange with other programs.

LTspice and Matlab can import and export .WAV files.

Perhaps this may be helpful for this issue.

Regards

Bernhard



 

¿ªÔÆÌåÓý

Jim,

Whilst the original Berkley SPICE and SPICE2 were written in FORTRAN , SPICE3 which was released in the early 1980¡¯s was written in ¡°C¡±. I can¡¯t see that LTSPICE ever used Fortran.

?

I have downloaded the older FORTRAN version and run it under the Hercules Emulator. It works OK but its no where as easy LTSpice.

?

The LT Wiki implies the original version of SwitcherCAD based on SPICE3 so that was in ?¡°C¡± but of course it could have been translated to another language for building SwitcherCAD as it was then¡­ ?

?

?

there is also more information on the history of Berkley Spice and its derivatives here:-

?

?

and here:-

?

?

Dave

G4UGM

?

?

?

From: LTspice@...
Sent: 23 December 2018 21:36
To: rupali45@... [LTspice]
Subject: Re: [LTspice] FFT

?



The original Berkeley SPICE core was written in Fortran. That core was rewritten for LTspice just a couple of years ago. Whether or not it was maintained in Fortran or ported to some other language its totally unknown. It IS remotely possible that writing to the ¡°contact¡± email address in the LThelp file might give you some hints, but I would not count on it. Mike, the author, has been pretty ¡°tight lipped¡± about such details.

?

Jim

?

James Wagner

Oregon Research Electronics

?

?

?

On Dec 23, 2018, at 11:18 AM, Andy ai.egrps@... [LTspice] <LTspice@...> wrote:

?

?

kamelia noroozi wrote:

?

? ? "?????

? ? ?? ???? ?? ???? ??ltspicce ??? ?? ????? ?? ?? ???? ???

? ? ?????? ???? ?? ???? ????

? ? ??? ????"

?

Please use English only.? This group's language is English, and the group's owner/moderator has said that English must be used.

?

Translated:

?

? ? "Hello
? ? ??? ltspicce you know what the code was written so in
? ? ?I'm grateful that you've helped me
? ? ?Thanks"

?

We don't.? I would guess that it might be more than one.

?

Except as an intellectual curiosity, it does not matter.

?

Regards,

Andy

?

?

?

?





 

There may be some disagreement about the origins of LTspice, whether or not it was at all based on Berkeley's SPICE code, or if it is a complete write from scratch.? It's my understanding (based in part on something Mike Engelhardt wrote for Linear Tech) that LTspice/SwitcherCAD was not derived from Berkeley SPICE, but that the code was his own creation, based in part on the algorithms that Berkeley SPICE used, considerably enhanced by Mike's own algorithms and coding skills.? That's why it runs faster than other SPICE programs.? I think it's safe to say that so much of it has been written anew, that no or almost no Berkeley SPICE code remains.

Mike uses whatever language(s) he found helpful.? In my opinion, it's highly unlikely that he ever used FORTRAN in LTspice.? In my opinion, it's probable that he uses (at least) C and Assembly.? Comparisons with the languages used by other SPICE programs (including Berkeley SPICE) are probably meaningless.? We also know that LTspice writes some code on-the-fly.? What might that be?? I don't know, but I'm guessing machine object code.

The PC version of LTspice today appears to call some Microsoft runtime functions.? That observation is based on feedback about some of the errors that happen, as well as the numeric results one gets when numbers overflow (e.g., 1.#QNAN, 1.#IND, 1.#INF).

LTspice's name originally did not even include the acronym "SPICE".? It was "SwitcherCAD" -- with "LTspice" becoming a nickname.? At some point, Mike gave in and officially renamed it to LTspice.

Regards,
Andy



 


"Hello
? ? you know how the code was written so in ltspice ??
? ? ?I'm grateful that you've helped me
? ? ?Thanks

On Monday, December 24, 2018, 9:07:37 AM GMT+3:30, Andy ai.egrps@... [LTspice] wrote:


?

There may be some disagreement about the origins of LTspice, whether or not it was at all based on Berkeley's SPICE code, or if it is a complete write from scratch.? It's my understanding (based in part on something Mike Engelhardt wrote for Linear Tech) that LTspice/SwitcherCAD was not derived from Berkeley SPICE, but that the code was his own creation, based in part on the algorithms that Berkeley SPICE used, considerably enhanced by Mike's own algorithms and coding skills.? That's why it runs faster than other SPICE programs.? I think it's safe to say that so much of it has been written anew, that no or almost no Berkeley SPICE code remains.

Mike uses whatever language(s) he found helpful.? In my opinion, it's highly unlikely that he ever used FORTRAN in LTspice.? In my opinion, it's probable that he uses (at least) C and Assembly.? Comparisons with the languages used by other SPICE programs (including Berkeley SPICE) are probably meaningless.? We also know that LTspice writes some code on-the-fly.? What might that be?? I don't know, but I'm guessing machine object code.

The PC version of LTspice today appears to call some Microsoft runtime functions.? That observation is based on feedback about some of the errors that happen, as well as the numeric results one gets when numbers overflow (e.g., 1..#QNAN, 1.#IND, 1.#INF).

LTspice's name originally did not even include the acronym "SPICE".? It was "SwitcherCAD" -- with "LTspice" becoming a nickname.? At some point, Mike gave in and officially renamed it to LTspice.

Regards,
Andy