Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

1 Ansicht (letzte 30 Tage)
Jake Elliott
Jake Elliott am 18 Okt. 2020
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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:

Antworten (1)

Durganshu
Durganshu am 19 Okt. 2020
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