LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I want triangular wave fitting.

hello .
I end up needing a triangle wave fitting.
This is because we need to distort the triangle wave. 

I don't know what the problem is in your current VI.

yeers_1-1732017169001.png

I am trying to fit a signal like the one in the picture above with a triangular wave.
I'm having trouble putting together an example code.


regards

yeers_0-1732017139407.png

 

0 Kudos
Message 1 of 5
(192 Views)

Your picture does not show a triangular wave.

Nobody in his right mind would use the formula version of Levenberg-Marquardt. (Besides, your model description has several issues). Start with creating a proper model VI, and make sure it calculates something resembling your data given the parameter estimates.

 

For more examples, have a look at my group here.

 

Can you write out the formula you like to fit?

 

Your current input data looks as follows. Where exactly do you see a "triangle wave"?

 

altenbach_0-1732028913502.png

 

Message 2 of 5
(160 Views)

Thanks to reply

fist I want to distortion wave form to triangular 

below image A to B

yeers_0-1732052912674.png

A

yeers_1-1732052926505.png

B

 

So, Ignore the arrays in the sample code.
Can I finally fit these A waveforms to B or

do I need to use a different method for distortion?

 

 

I'm checking your sample code .

 

Regards

0 Kudos
Message 3 of 5
(135 Views)

A and B look very different. Do you have some real data?

What is the model equation? What are typical model parameters?

0 Kudos
Message 4 of 5
(126 Views)

1. Original wave form data in VI file

 

2. I tried expressing an expression using a formula node.

 

 z = x / T; // Normalize x by period
frac_part = z - floor(z); // Fractional part of z
y = A * (2 * abs(frac_part - 0.5)) + C; // Triangle wave formula

 

So parameters is 

A : amplitude

T : peroid

x: time

C: offset

 

If there is a different way to distort the triangular wave, please let me know.

0 Kudos
Message 5 of 5
(117 Views)