Capacitor Voltage calculation from current

4 views (last 30 days)
Abu Sufyan
Abu Sufyan on 13 Jul 2021
Answered: Walter Roberson on 13 Jul 2021
Ia1 and Ia2 is input from simulink model
C = 15e-6
Ic= Ia1-Ia2;
Vc1 = @(C, Ic) (1/C)*(Ic);
Vca = integral(Vc1,0,1);
Error:
Error in grid (line 12)
Vca = integral(Vc1,0,1);

Answers (1)

Walter Roberson
Walter Roberson on 13 Jul 2021
The first parameter to integral() must be a function handle that expects one input. You are passing a function handle that expects two inputs.
You have assigned C as a constant value so it would seem to make the most sense to use
Vc1 = @(Ic) (1/C)*Ic;
However, you do not need to do a numeric integration to solve that, as it is simple case of constant*x:
integral of Ic/C for Ic = 0 to 1 is Ic^2/(2*C) from 0 to 1 which is 1/(2*C) - 0/(2*C) which is 1/(2*C)
.. though you said Ia1 and Ia2 are inputs. If your integral is over C then the integral would be Ic*(log(upperbound)-log(lowerbound)) which would be Ic*(log(1)-log(0)) which would be Ic*(0-(-infinity)) which would be Ic*infinity which would be sign(Ic)*infinity

Categories

Find more on Simscape Electrical in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!