Calculate dV/dQ to plot differential voltage analysis curve?
    조회 수: 19 (최근 30일)
  
       이전 댓글 표시
    
 I have all the required data but do not know how to differentiate my voltage with respect to discharge/charge capacity given.
댓글 수: 5
  John D'Errico
      
      
 2022년 6월 3일
				@Alberto Cuadra Lara Comments cannot be accepted as answers. If you want credit for an answer, then you need to post it as an answer.
  Alberto Cuadra Lara
      
 2022년 6월 3일
				채택된 답변
  Alberto Cuadra Lara
      
 2022년 6월 3일
        Hello Ekagra,
I guess you have numerical values of the voltage as a function of the discharge/charge capacity, right? In this case, you can compute the first derivative numerically, e.g., using finite central differences as follows, where x and y will be Q and V, respectively.
% Definitions
x = linspace(0, 2*pi);
y = sin(x);
% Compute first derivative
dydx = compute_first_derivative(y, x);
% Plot
figure; hold on;
plot(x, y);
plot(x(2:end), dydx);
xlabel('x', 'interpreter', 'latex')
ylabel('y', 'interpreter', 'latex')
legend({'y(x)', 'dy(x)/dx'}, 'interpreter', 'latex', 'location', 'northeastoutside');
% SUB-PASS FUNCTION
function dxdy = compute_first_derivative(x, y)
    % Compute first central derivate using a non-uniform grid
    %
    % Args:
    %     x (float): Values for the corresponding grid
    %     y (float): Grid values
    %
    % Returns:
    %     dxdy (float): Value of the first derivate for the given grid and its corresponding values
    % 
    % Author: Alberto Cuadra-Lara
    h = y(2:end) - y(1:end-1);
    hmax = max(h);
    mu = h / hmax;
    dxdy = zeros(1, length(h));
    dxdy(1) = ((x(2) - x(1)) ./ h(1));
    for i = 2:length(mu)-1
        dxdy(i) = (mu(i)^2 * x(i+1) - (mu(i)^2 - mu(i+1)^2) * x(i) - mu(i+1)^2 * x(i-1)) / ((mu(i)^2 * mu(i+1) + mu(i) * mu(i+1)^2) * hmax);
    end
    % Direct method
    % dxdy(2:end-1) = (mu(2:end-1).^2 .* x(3:end-1) - (mu(2:end-1).^2 - mu(3:end).^2) .* x(2:end-2) - mu(3:end).^2 .* x(1:end-3)) ./ ((mu(2:end-1).^2 .* mu(3:end) + mu(2:end-1) .* mu(3:end).^2) * hmax);
    dxdy(end) = ((x(end) - x(end-1)) ./ h(end));
end
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

