Info

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

How do I make a logamarithic curved line of best fit?

조회 수: 1 (최근 30일)
Jake Elliott
Jake Elliott 2020년 10월 18일
마감: MATLAB Answer Bot 2021년 8월 20일
This is my Code:
Stim=[200 250 350 600];
Volt_Max=[max(mV200(:,3)) max(mV250(:,3)) max(mV350(:,3)) max(mV600(:,3))];
plot(Stim,Volt_Max,'h')
ylabel('Voltage (mV)')
xlabel('Stimulus Voltage (mV)')
xlim([200 700])
title('Effect of Stimulus Intensity on Active Propagations')
grid on
logx=log(Stim)
logy=log(Volt_Max)
Const=polyfit(logx, logy, 6)
hold on
plot(Stim, exp(polyval(Const, logx)));
I want a curved plot, however, the plot I get becomes this:

답변 (1개)

Durganshu
Durganshu 2020년 10월 19일
You can manually code the problem to store more intermediate values through interpolation in order to make the curve more smooth. Predefined function pchip can be used for this. Read the documentation here: https://in.mathworks.com/help/matlab/ref/pchip.html
You can also use teh Curve Fitting toolbox for your purpose. Read this documentation: https://in.mathworks.com/help/curvefit/curve-fitting.html
The easiest way to solve this issue and get a smooth curve will be to perform interpolation and obtain more values between two data points (marked with 'o' on the shown graph). This will definitely smoothen the curve.

Community Treasure Hunt

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

Start Hunting!

Translated by