perform polyfit on a semilogy plot

조회 수: 4 (최근 30일)
Alexander Derrico
Alexander Derrico 2022년 10월 23일
답변: Torsten 2022년 10월 23일
I have 2 sets of data, t_discharge and Volt_discharge. I want to plot t vs volt in a semilog graph where t is x axis and vollt is y axis with log scale. How do I plot a first order line of best fit through this graph and get slope and y-intercept? Thanks!

채택된 답변

Torsten
Torsten 2022년 10월 23일
t_discharge = 837×1
1.0e+00 * 0 0 0 0 0 0.0010 0.0010 0.0010 0.0010 0.0010
A = [ones(numel(t_discharge),1),t_discharge];
b = log10(Volt_discharge);
x = A\b;
semilogy(t_discharge,[Volt_discharge,10.^(x(1)+x(2)*t_discharge)])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by