Borrar filtros
Borrar filtros

Plot function with different parameter

2 visualizaciones (últimos 30 días)
Grega Mocnik
Grega Mocnik el 19 de Dic. de 2017
Editada: Adam el 19 de Dic. de 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 comentario
Adam
Adam el 19 de Dic. de 2017
Editada: Adam el 19 de Dic. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by