# I integrated fault current which is sine wave with its time period as an interval. But, i am getting value as an answer instead of getting 0.

2 views (last 30 days)
A Lumbini on 7 Jan 2024
Commented: Paul on 8 Jan 2024
F=0.05
ix = (Phasecurrent.Time >= F) & (Phasecurrent.Time <=F+0.020047);
Int = cumtrapz(Phasecurrent.Data(ix))
vpa(Int(end))
ans =
137031976.93982961773872375488281
A Lumbini on 8 Jan 2024
Can't we implement proper integral in matlab
Paul on 8 Jan 2024
Why not just implement it in Simulink? Use a Clock, two Compare to Constant blocks, and an AND to output signal that is 1 (or true) over the desired interval and 0 otherwise. Multiply that signal with signal to be integrated and send that product into an Integrator. Make sure to use a variable step solver with zero crossing detection turned on, at least for the Compare to Constant and AND blocks, if not for the whole model.

madhan ravi on 7 Jan 2024
Edited: madhan ravi on 7 Jan 2024
Not sure what you are doing with your code. When using cursor measurements the 2 cursor points should measure same value as 0. DeltaY should be 0. But in the screenshot you shared it’s not 0. As you can see at .05 the lower half sine wave is not exactly a sine wave , the shape of the u curve is not the same as the others.
As from your previous question, it was mentioned that continuous method is being used. Hence the correct syntax is:
Int = cumtrapz(PhaseCurrent.Time(ix),Phasecurrent.Data(ix))
madhan ravi on 8 Jan 2024
"Sorry maybe i didn't select proper zero crossings to find time period"
Yes.
"i am integrating from 0.05 to (0.05+20ms) the value i am getting is not even close to zero is it just because i am using numerical integration due to which it will not be pure sinewave"
Like I said
"But in the screenshot you shared it’s not 0. As you can see at .05 the lower half sine wave is not exactly a sine wave , the shape of the u curve is not the same as the others."
Try choosing the next interval. Beware in the y scale axis, it is 10^8
.
Sorry you need to figure it out by yourself. I don't have time to analyze in detail.
A Lumbini on 8 Jan 2024
Edited: A Lumbini on 8 Jan 2024
k thank you sir

### Categories

Find more on Sources in Help Center and File Exchange

R2023a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!