Filter löschen
Filter löschen

How to fit a linear line on a semilog plot?

4 Ansichten (letzte 30 Tage)
Duncan Wright
Duncan Wright am 17 Apr. 2018
Bearbeitet: Duncan Wright am 17 Apr. 2018
I'm struggling to fit a linear line on my log linear regression. Here is my code:
figure(2)
subplot(2,2,1)
[slope7, intercept7, MSE7, R27, S7, extra7] = logfit(totSPM,s2gbratio,'logx') % logfit is a function from the file exchange, uses semilogx.
fit7 = fitlm(log(totSPM),s2gbratio) % get x1/intercept/SE
hold on
% confiedence intervals. Highest line.
hx1 = (0.1546 + 0.036612); % get highest x1 value (x1 + SE)
hInt = (intercept7+0.077203); % get highest intercept value (intercept + SE)
x= linspace(0,10, 50); % Adapt n for resolution of graph
y= hx1*x + hInt; % highest confidence interval I want to plot as linear
plot(x,y,'b--') % plot highest confidence interval
As its on a semilog plot the output is a curve.
Is there any way round this ?
I've attached an image of my output using this code (sorry bout the volume bar... oops)
Kind regards, Duncan

Antworten (0)

Kategorien

Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by