calculate the rectified value

25 ビュー (過去 30 日間)
Emefun
Emefun 2022 年 4 月 3 日
コメント済み: Emefun 2022 年 4 月 3 日
Hey, im new here. Today we were given the task of calculating the rectified value of a function. I have already written this function and it works as required. Now we have to compare this result with the build-in function of Matlab, but I can't find this function anywhere. Can someone please help me?
function [rectified_value] = my_rv(A)
%rectified value
%calculate rectified value of a series of data
% Input...matrix [] or function
a = size(A); %identify matrix dimension
amount_A = abs(A); %convert negative numbers to positive numbers
sum_a = sum(amount_A, "all"); %sum every single value in the matrix
numBer = a(1,1)*a(1,2); %calculate number of places within a matrix
rectified_value = (1./numBer).*(sum_a); %calculate the rectified value
end

採用された回答

Torsten
Torsten 2022 年 4 月 3 日
built_in_value = mean(abs(A(:)))
  1 件のコメント
Emefun
Emefun 2022 年 4 月 3 日
Thank you very much, I didn't know it was that easy. Have a nice Sunday

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecialized Power Systems についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by