Clear Filters
Clear Filters

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)
F=0.05
ix = (Phasecurrent.Time >= F) & (Phasecurrent.Time <=F+0.020047);
Int = cumtrapz(Phasecurrent.Data(ix))
vpa(Int(end))
ans =
137031976.93982961773872375488281
  4 Comments
Paul
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.

Sign in to comment.

Accepted Answer

madhan ravi
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))
  4 Comments
madhan ravi
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.

Sign in to comment.

More Answers (0)

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!