05-11-2011 10:14 AM
when integrating by the integral x(t).vi, the output is always getting shifted by the constant...... how can we set the integration constant to 0?? .....thanx....
05-12-2011 04:18 AM
Hello,
and thank you for posting here.
Coud you give me more details please? Where did you find your x(t).vi? Could you post your VI?
Regards,
Jérémy C.
NI France
05-12-2011 07:23 AM
integral x(t).vi is in the mathematics sub palette.....
details about my code is not an issue now.... i am not even getting the right answer wen i integrate a sine wave..... i should get the negative cosine wave... but its getting shifted by a constant.... i read bout the integral x(t). vi and that it gives the definite integration.... and therefore the constant is also taken into account... my question is how to set that the constant to 0 or any value of our choice????
05-12-2011 08:09 AM
I suppose that you noticed that integral x(t).vi is for discrete integrations. Depending on the values you have connected to the inputs, results will be different. It is the reason why I'm asking you to post your VI (or a small part) in order to see the implementation of you VI.
Regards,
Jérémy C.
NI France
05-12-2011 09:40 AM
I have attached a copy of my code and in this case i am not even getting a cosine wave after integration( i atleast got a cosine wave after integration wen i used the sine function from the trigonometric subpalette).
I am acquiring a sine wave from an oscilloscope and storing it in a text file.
the first column is time and the second column is voltage.
It acquired data at 4 instants, therefore there r 8 columns in the text file attached.
now i want to integrate the voltage values.
So i extracted the first 2 columns for integration calculation.
can u please help me out with this??
05-12-2011 12:04 PM
I suspect the issue is the format string. The data in the text file has a comma for the decimal separator. The Read from Spreadsheet File VI expects period as the decimal separator unless you tell it otherwise. Try "%,; %.12f" (without the quotes) as the format string. the %,; part tell ist to use the comma as the decimal separator.
Lynn
05-16-2011 06:35 AM
The format string is not the issue. I used %.12f only as the format string.
Besides the data in the text file itself was saved through the write to spreadsheet file.vi from an oscilloscope.
05-16-2011 06:46 AM
The text file you posted has comma separators:
0,000120000000 -0,043750023360 0,000130000000
It does not matter how the file was saved. The format of the file does matter. I think the Read from Spreadsheet File.vi uses period separators unless you tell it otherwise. Your system settings are not used by this VI.
When I tried the format string I posted earlier it read the file fine. With your format string it does not work. Have you tried it?
Lynn
05-16-2011 07:25 AM
Hi,
I think what Jhonsold told is correct. Kindly have a look on the attached VI.
Regards,
Nitzz
(Kudos are always Welcome, Mark as a solution if it is the One;))
05-16-2011 07:27 AM - edited 05-16-2011 07:28 AM
with "my format string" ?
The code that i posted has the %.12f as the format only.
Besides if write to spreadsheet.vi saved it in that format then, obviously read from spreadsheet.vi can read the same format.
And yes, i tried it. again its there in the posted code.
When i plot the data from text file on a graph, it shows a sinewave, which is correct, since that is wat i acquired form the oscilloscope.
But wen i integrate it with the integral x(t).vi i dont get a minus cosine wave. so the problem is not in the format string.