フィルターのクリア

How to find out mean within a loop?

2 ビュー (過去 30 日間)
Prathap Sakalenahalli Honnegowda
Prathap Sakalenahalli Honnegowda 2017 年 12 月 12 日
Number_of_measurements= 5;
numfreq = 201;
k= 50;
for n = 1:Number_of_measurements
filename = ['S_30_',num2str(n),'.s1p'];
S = sparameters(filename);
Z = zparameters(filename);
freq = S.Frequencies; % Frequency values are the same for all files
frequency=freq(k);
z11 = rfparam(Z,1,1);
Capacitance1 = 1/abs(2*pi.*freq(k).*z11(k))
end
I want to calculate mean for this Capacitance1. If I am using A=mean(Capacitance1) It is just giving me the last value of Capacitance1.
To be clear using above loop, I will have 5 capacitance1 values after running it, but when trying to find out mean, it is only giving me the last value of capacitance1. I want it for all values of capacitance1. Help me finding it!
  2 件のコメント
KL
KL 2017 年 12 月 12 日
Please format your code. Select the code snippet in your post and click {} Code button
Prathap Sakalenahalli Honnegowda
Prathap Sakalenahalli Honnegowda 2017 年 12 月 12 日
Now?

サインインしてコメントする。

採用された回答

KL
KL 2017 年 12 月 12 日
Store the result from each iteration and then calculate mean outside the loop.
Capacitance1 = zeros(1,Number_of_measurements);
for n = ...
...
Capacitance1(n) = 1/abs(2*pi.*freq(k).*z11(k));
end
Cap_mean = mean(Capacitance1);
  1 件のコメント
Prathap Sakalenahalli Honnegowda
Prathap Sakalenahalli Honnegowda 2017 年 12 月 12 日
Thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by