LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

building waform from formula node

Dear Sir,

 

I am trying to build a waveform from output of a formula node.

 

I have fitted a 10th order polynomial on  frequency response of my system and in the code i have inverted the system and found out amplitude
(AMP) and phase (PHA) at different harmonics of fundamental frequency f.

Now i construct the signals (f0) with 10000 point by adding up the harmonic content at each harmonic frequency.

 

I want to generate a continuous signal.

 

Could you suggest what is wrong with the code

0 Kudos
Message 1 of 8
(3,005 Views)

Here are the coefficients i have for the input

0 Kudos
Message 2 of 8
(2,998 Views)

Hi Sachindian,

 

what's wrong?

 

- You want us to type more than a dozen values into your VI! Why don't you set those parameters default?

- You rely on a big formula node. Most/all of the code in there can be done by simple G functions:

  - Generating the t[i] array is a simple call of the Ramp function.

  - Calculating AMP and PHA is really simple when you put all coefficients into array and just call the "Polynomial Evaluation" function.

 

So clean up your VI and set all default input values...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 8
(2,980 Views)

Hello Gerd,

 

i am sorry for the messy work. I am not very advanced user of Labview and just shifting from Matlab to Labview. It is a bit difficult to change the outlook as you can see altough i am using labview i have coded it like matlab.

Thanks for your suggestion. I will try them and get back to you ..

 

Regards

Sachin

0 Kudos
Message 4 of 8
(2,974 Views)

Hello Gerd

 

Your suggestions were very helpful. I got to prgram the amplitude and phase part.

I am still stucked with the generating the Waveform. Could you please guide me what i can do to program this second part in labview.

 

Thanks for your help. Please guide me through this last part.

 

 

0 Kudos
Message 5 of 8
(2,963 Views)

I have updated the code.

 

I am trying to generate the signals by adding the sine waves generated by different harmonics. I am getting all the harmonic content but i am not able to add it. i dont know where it is getting wrong.

 

Could you please help me i am getting confused with it.

0 Kudos
Message 6 of 8
(2,929 Views)

Hi Sachindian,

 

there is a big problem in your code: in the first iteration you do a division by zero...

 

That's why I had to strip the first output element of your waveform array:

check.png

 

Hint: You can multiply and add the waveforms in your main FOR loop. No need to do this after that loop has finished...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 8
(2,918 Views)

Hello Gerd,

 

Thanks for your suggestion. Something is working.but there are still some issues i am not able to figure out.

 

I need to implement the formula. The sine part of the formula i.e addition and multiplication works fine. but when i try to put in the rest of the part (8/pi^2) and all. the code seems to freeze. I dont understand what is the problem there.

Another thing is the code only runs till harmonics that are less than 500 hz for some reason. I am unable to get the bug there.

 

Could you please have alook.

 

 

 

0 Kudos
Message 8 of 8
(2,908 Views)