Capacitor Voltage calculation from current
5 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
回答(1 个)
Walter Roberson
2021-7-13
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simscape Electrical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!