Azzera filtri
Azzera filtri

Plot function with different parameter

2 visualizzazioni (ultimi 30 giorni)
Grega Mocnik
Grega Mocnik il 19 Dic 2017
Modificato: Adam il 19 Dic 2017
I have a problem with plot calculated function with various parameter. My code is:
N = 22.5;
f = 868;
d_ref = 1;
floor_PLF = [0, 9, 19, 24];
floor_n = [0, 1, 2, 3];
dist_step = 0.5;
dist_max = 50;
IPL = zeros(4 ,300);
FSPL = 20 * log10(d_ref) + 20 * log10(f) - 28;
test = floor_PLF(3);
figure;
for counter = 1:length(floor_n)
d = 0 : dist_step : dist_max;
f_PLF = floor_PLF(counter);
f_n = floor_n(counter);
floorPL = f_PLF .* f_n;
IPL = FSPL + N *log10(d/d_ref) + (floorPL(counter));
plot(d, IPL, '.'); hold on;
end
I get error: index exceeds matrix dimensions. in statement where I have IPL = FSPL .... And my code plot just one function, the first one.
I would like plot different function with different parameter from floor_PLF and floor_n array.
  1 Commento
Adam
Adam il 19 Dic 2017
Modificato: Adam il 19 Dic 2017
floorPL
appears to be scalar and there is no need to index into it with 'counter' since it is calculated within that loop each time.
IPL = FSPL + N *log10(d/d_ref) + (floorPL);
looks like it would work at a glance.

Accedi per commentare.

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