Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

[EMERGENCY NEED CRITICAL HELP] Numerically determine the Voltage

3 visualizzazioni (ultimi 30 giorni)
DO i differentiate i(t) first, then substitute into the eq for v(t) ? please help
see attached pic for the full details.

Risposte (1)

Jim Riggs
Jim Riggs il 12 Dic 2017
Modificato: Jim Riggs il 12 Dic 2017
You are given an equation for i(t). All you need to do is integrate it directly, but your instructions are to perform the integration numerically, and not use the int function.
First, set the problem constants:
Q0 = 0;
C = .003;
To perform numerical integration, you need to define the discrete time parameters;
Tstart = 0; % integration start time
Tstop = 7; % integration stop time
dt = .001; % this is the time step
nstep = (Tstop-Tstart)/dt + 1; % This is the number of integration steps
Next, you might want to initialize the data vectors:
clear time current volt dv
time = zeros(1,nstep);
current = zeros(1,nstep);
volt = zeros(1,nstep);
dv = zeros(1,nstep); % this is the differential voltage which is being integrated
Now perform the integration calculation loop:
for i=1:nstep
time(i) = (i-1)*dt;
current(i) = 0.3 + 0.1*exp(-5*time(i)) * sin(25*pi*time(i)); % this is the current function, i(t)
dv(i) = current(i)*dt + Q0; % this is the quantity inside the integral
% numerical integration is simply summing
if i ==1
volt(i) = 1/C * dv(i);
else
volt(i) = volt(i-1) + 1/C * dv(i);
end
end
Time step, dt
In general, the smaller the time step (dt) the more accurate the answer will be. Note that the current function has a frequency of 12.5 Hz (25 * Pi * t), so this is one of the determining factors regarding what size time step you should use. The number of integration samples should be at least 10 per cycle. This would equate to a time step of 125 per second, or 0.008 seconds. dt should be smaller than this. I chose to use 1000 Hz, dt=.001.
It's always a good idea to try different values to see how it effects the answer.

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by