Filter löschen
Filter löschen

Plot function with different parameter

2 Ansichten (letzte 30 Tage)
Grega Mocnik
Grega Mocnik am 19 Dez. 2017
Bearbeitet: Adam am 19 Dez. 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 Kommentar
Adam
Adam am 19 Dez. 2017
Bearbeitet: Adam am 19 Dez. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Line Plots 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