Clear Filters
Clear Filters

The easiest way to add a line of determined slope to a loglog

16 views (last 30 days)
Hello! I have a graph made by
loglog();
and I would like to add determined slope. I am not saying about linear fit or trend. I am interested to add a line of determined slope to a loglog.
Imagine that we have this:
clear;clc;clf;
f= ; % some argument input
Spectrum_Power =;% somefunction of f
loglog(f,Spectrum_Power);
grid on;
And how to add a slope of -5/3 to this plot? Thanks in advance!

Accepted Answer

David Goodmanson
David Goodmanson on 18 Mar 2017
Hello Ivan, A straight line of slope -5/3 on a loglog plot has the form log(y) = (-5/3)*log(x) + b with an arbitrary constant b. Exponentiating both sides gives
y = c*x.^(-5/3);
with a constant c = exp(b) which is arbitrary except that c > 0. So the form above with any positive c will give the requisite straight line on a loglog plot.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!