Info
This question is closed. Reopen it to edit or answer.
How do I make a logamarithic curved line of best fit?
1 view (last 30 days)
Show older comments
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:
0 Comments
Answers (1)
Durganshu
on 19 Oct 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.
0 Comments
This question is closed.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!