Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

1 visualización (últimos 30 días)
Jake Elliott
Jake Elliott el 18 de Oct. de 2020
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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:

Respuestas (1)

Durganshu
Durganshu el 19 de Oct. de 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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by