フィルターのクリア

Hello guys how can put this equation into matlab FAR is probability i would like to use for loop to find solution when various n=0:1:4 and plot this

2 ビュー (過去 30 日間)
q1=0.1587;
q2=1-q1;
for n=0:1:4;
FAR=q1.^n.*(1+q2+q2.^2+q2.^3)/((q1.^n.*(1+q2+q2.^2+q2.^3)+(q2.^n.*(1+q1+q1.^2+q1.^3))))
plot(n,FAR)
end

採用された回答

Walter Roberson
Walter Roberson 2021 年 12 月 18 日
q1=0.1587;
q2=1-q1;
for n=0:1:4;
FAR=q1.^n.*(1+q2+q2.^2+q2.^3)/((q1.^n.*(1+q2+q2.^2+q2.^3)+(q2.^n.*(1+q1+q1.^2+q1.^3))))
plot(n,FAR, '*-');
hold on
end
FAR = 0.7258
FAR = 0.3330
FAR = 0.0861
FAR = 0.0175
FAR = 0.0033
xlim([-.5 4.5])
hold off
You are only plotting one point at a time, and MATLAB never draws connecting lines if you only plot one point at a time. If you want connecting lines you should record your n values and your results and plot() after the loop.
q1=0.1587;
q2=1-q1;
nvals = linspace(0,4);
num_n = length(nvals);
FAR = zeros(1, num_n);
for nidx = 1 : num_n
n = nvals(nidx);
FAR(nidx) = q1.^n.*(1+q2+q2.^2+q2.^3)/((q1.^n.*(1+q2+q2.^2+q2.^3)+(q2.^n.*(1+q1+q1.^2+q1.^3))));
end
plot(nvals, FAR)
xlim([-.5 4.5])

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by