필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

[EMERGENCY NEED CRITICAL HELP] Numerically determine the Voltage

조회 수: 3 (최근 30일)
james bond
james bond 2017년 12월 5일
마감: MATLAB Answer Bot 2021년 8월 20일
DO i differentiate i(t) first, then substitute into the eq for v(t) ? please help
see attached pic for the full details.

답변 (1개)

Jim Riggs
Jim Riggs 2017년 12월 12일
편집: Jim Riggs 2017년 12월 12일
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.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by