フィルターのクリア

How to write this formula in Matlab

2 ビュー (過去 30 日間)
Nicolas Ostinelli
Nicolas Ostinelli 2022 年 4 月 20 日
コメント済み: Jan 2022 年 9 月 27 日
Hello to everyone,
how can I traduce this formula in Matlab:
Ustat and Ucalib value are float number.
Thank you for your help.

回答 (3 件)

Abhijeet
Abhijeet 2022 年 6 月 19 日
Hi Nicolas Ostinelli,
You can refer to the code below.Let me know if there is any error.
%constant values
U_stat=0.12;
U_calib=0.3;
U_stat_sq=U_stat*U_stat;
U_calib_sq=U_calib*U_calib;
% calculating the summation part
sum=0;
n=10;
for i=1:n
sum=sum+U_stat_sq*i;
end
sum_sqrt=sqrt(sum);
first=(1/n)*sum_sqrt;
first=first*first;
U_fin=sqrt(first+U_calib_sq);

Jan
Jan 2022 年 6 月 19 日
Ufin = sqrt((1 / n * sum(Ustat .^ 2))^2 + Ucalib .^ 2)

Daksh
Daksh 2022 年 9 月 27 日
Hi,
It is my understanding that you possess Ustat (float number array) and Ucalib (float number) and you want to rewrite that formula as a representation in MATLAB. The following code illustrates how to achieve the above:
U_fin=(((1/n)*sum(Ustat.^2))^2+Ucalib.^2)^0.5
Here I have used ".^2" notation for element-wise squaring arithmetic operation, which saves me the effort of writing another for loop. Hope this helps.
  1 件のコメント
Jan
Jan 2022 年 9 月 27 日
I agree. I've posted this formula already. SQRT is faster than .^0.5 .

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

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by