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

29 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

David Goodmanson
David Goodmanson il 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.

Più risposte (0)

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by