11-19-2024 05:53 AM
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.
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
11-19-2024 08:57 AM - edited 11-19-2024 09:08 AM
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"?
11-19-2024 03:51 PM
Thanks to reply
fist I want to distortion wave form to triangular
below image A to B
A
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
11-19-2024 04:31 PM
A and B look very different. Do you have some real data?
What is the model equation? What are typical model parameters?
11-19-2024 05:47 PM
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.