필터 지우기
필터 지우기

Plot function with different parameter

조회 수: 2 (최근 30일)
Grega Mocnik
Grega Mocnik 2017년 12월 19일
편집: Adam 2017년 12월 19일
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
Adam
Adam 2017년 12월 19일
편집: Adam 2017년 12월 19일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by