LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

appropriate filter

Dear Lynn,

Thanks you for your kind suggestions about using Lev-Mar Curve Fitting VIs to fit. Unfortunately, it is not included in the basic labview 7.1 package. I will try and let you know the outcomes.

regards,

Toyota
0 Kudos
Message 11 of 23
(1,970 Views)
Toyota,

I tried your data with the sine fitting routine I put together about a year ago. With good initial guesses it fits very nicely to your data.

I have attached a screenshot of the result.

I think the Lev-Mar routines changed substantially between version 7.1 and 8.2 so I don't think I can save it back to your version.

Lynn
0 Kudos
Message 12 of 23
(1,952 Views)

Dear Lynn,

 

Thanks for your time and efforts. It is amazing that you can fit my curve with Lev-Mar Curve Fitting. However my goal is hysteresis loop and it is directly dependent upon the smooth curve output of HP (applied magnetic field) as you can see in the screen shot of HP (applied magnetic field), Keithley (Sample voltage) and the result Hysteresis loop.

Is there any way to eliminate the spikes because without eliminating the spikes, I could not get good data.

I hope the problem lies in the step voltage VI. There are three curve parts

0: 0 to +10 V

1:+10 to -10 V

2:-10 to +10 V

 

I noticed that the spikes appear between the 0 V ~- 2 V and -0.5 ~+0.5 respectively. Please let me know .

0 Kudos
Message 13 of 23
(1,938 Views)
Toyota,

Sorry it took me a while to get back to you. I had to do some of my own work!

Something in your last reply triggered some thinking: If you know what is causing the spikes, maybe we can suppress them rather than filtering them.

The attached VI starts with your string data (saved in the "all rows" control). It converts the text to a numeric array.

The next for loop identifies the spikes. I noticed that the slope of the data in the spike regions is much larger than in the good data region. I subtract successive values of the data and declare that any difference greater than +/-0.5 is part of a spike.

The next two loops locate the start and end indexes of each spike and save these in an array of clusters.

The rightmost loop extracts a segment of Data before and after each spike, creates an array of indexes (or X-axis values) which match the segments. These segments are concatenated and fed to a linear regression VI )not in the Base package). The slope and intercept are used to calculate a straight line interpolation across the spike regions. The interpolated values are used to replace the spike values in the original data. The result is reported as Interpolated Data.

Run the VI and expand the chart in around the spikes. (Set the X-axis limits to 180 and 220 for example). You can see how well the data compares to the original.

This is still a fitting process, but it uses linear interpolation and only in the regions where the spikes occur. All the non-spike data is untouched.

I did not compare speed, but this process likely is faster than the Lev-Mar fit to a sine wave.

This has no error checking. If you look at the region around zero you will see that it does not handle the case of a spike at the beginning of the data set well. It is also not very efficient. This was partially done for clarity of explanation. Several of the for loops can probably be combined. If you have large datasets changing the build array primitives to Replace Array Subset is much better.

Lynn
Message 14 of 23
(1,924 Views)
Dear Lynn,

I really appreciate your kind effort and time.
I  have connected the HP meter data output with data input of  your HP despiker slope blank.vi and  then the output of interpolated data to the final  Graph. May be my question is silly. I have some problems and could not manage in the block diagrm.

I am a real novice and your help and suggestions would be great.

Thanks ,
Toyota
0 Kudos
Message 15 of 23
(1,910 Views)
Dear Linn,.

I connected to the measurement data ouput to the data in HP despiker slope blank vi and then output of interpolated data to the waveform graph. Is it correct?

I ran the HP step voltage measurement separately and found that the spikes occur in 200ms and 400 ms  between the transition from 0 to 0.03 and -0.04 to 0.04 step voltage in each measurement. I made step voltage to 0.10 in the measurement. In order to despike at 200 and 400ms both, how can I set up in this HP despiker slope blank VI?

Thanks in advance.
Toyota
0 Kudos
Message 16 of 23
(1,865 Views)
Toyota,

I am not able to understand exactly what you have done. Can you post your latest attempt along with some typical data so that I can look at it?

I think you are correct in your connection to the graph.

Lynn
0 Kudos
Message 17 of 23
(1,849 Views)
Dear Lynn,

I have attached the labview VI and screen shot as attached file. To be your clear understanding, I want to make step Voltge VI in the leftmost to control the power supply unit by increasing  and decreasing voltage gradually as in th eprevious post as(1) 0~+10V (2) +10~-10 v (3)-10V to 10 V by steps such as 0.01 V.0.10 V etc.

The next step is I made some delay time to measure the applied magnetic filed(measure by HP) and sample voltage (measure by Keithley). For example, I made 0.01 step up voltage , take some delay and measre first in HP and then take some delay for a while and measure the Keithley.

As the measurement time is quite long for smaller step voltages, I made shift registers in while loop and connect to graph that coolected both from HP and Keithley. Unfortunately, I could not mange to get the grph; I mean no graph appear . Everytime in the measurement, shift register is  giving me new data and do not store old data well in HP & Keithley measurements.

My questions  are

(1) Please let me know your opinion upon my use of while loops; first step voltage and then delay time. I think it is not synchronised as I mentioned  in the above bold paragraph.
(2) I connect the output data from the table to despike VI and then take out interpolated data to get graph. Is that good idea ?
(3) Should I need to ramp function instead of using step VI as I read your comments in some discussions in this forum.

Thanks in advance. Your kind suggestions are really very helpful for new user like me.

Toyota

0 Kudos
Message 18 of 23
(1,829 Views)
Toyota,

You are headed in the right direction, but your inexperience with LV shows.

First, try to avoid placing icons on top of each other. The HP34401A GPIB Write functions are stacked in such a way as to make it impossible to understand what it going on.
Second, LabVIEW uses dataflow to define the order of operations. The Sequence stucture in the Keithley loopcan be eliminated by wiring the error clusters.
Third, I do not understand exactly how you modified the Despiker VI. It appears that you have two outputs and no inputs.

I do not have your equipment so I cannot run the VI. From the structure of the VI it appears that it will behave like this:

Outer loop (Stop5) starts. The Stop5 button is read. Since it is false, the loop will stop when all nodes inside it finish executing. The voltage setting loop (Stop2) starts, reads the value of Stop2 (false), sends the first value to the voltage supply, waits 1 second and stops. The large inner loop (Stop4) starts before or after the Stop2 loop (certainly no later than microseconds into the 1 second wait), reads the Stop 4 button (false), writes to the 34401, and starts the HP and Keithley loops. The Stop4 loop will stop as soon as the HP and K loops finish. Both of those loops will stop at the end of their delays (1 and 5 seconds, respectively). The waits run simultaneously (approximately).

So, you set the voltage to the first point, read the HP once, read the Keithley once, build tables and graphs with one data point (plus stored data from the despiker), and exit after 5 seconds.

I think you may want to look at a state machine architecture for your program. It would have one loop (or two if you use a separate one for the user interface) and would have states like initialize, write voltage step, read HP, read Keithley, wait, update graphs, write to file, Reset voltage to zero, and shutdown.

Look at some of the examples which come with LV and the Design Patterns which can be found at File >> New.. >> VI >> From Template >> Frameworks >> Design Patterns >> Standard State Machine. This is from LV 8.2, but earlier versions have similar examples.

Lynn
0 Kudos
Message 19 of 23
(1,817 Views)
Dear Lynn,

Thank you for your kind suggestions. I will modify the program as you suggest. By the  way, can I use despiker HP vi without buiding table . I mean I just want to connect from the HP voltage output to the despiker VI. From which part , I can modify it? Since I just want to combine data from HP and another measurement data from Keithley, if I can modify it, I can save the time for measurement.

regards,
Toyota
0 Kudos
Message 20 of 23
(1,679 Views)