calculate a function based on array data

I need to calculate dispersion effect based on how much farther the observer from the chimney.
I came up with this kind calculation :
% edited for full variable
hasil = str2num(get(handles.hasil, 'string'));
koefisiena = str2num(get(handles.koefisiena, 'string'));
sigmaz = str2num(get(handles.sigmaz, 'string'));
vangin = str2num(get(handles.vangin, 'string'));
for distance= [0.25; 0.5; 0.75; 1; 1.25; 1.5; 1.75; 2; 2.25; 2.5;];
y= {(hasil./(2*3.14*(koefisiena*(distance.^0.894))*sigmaz*vangin))};
end
however it gives an error output
Error using ./
Matrix dimensions must agree.
Error in desain>pushbutton2_Callback (line 520)
y= {(hasil./(2*3.14*(koefisiena*(jaraks.^0.894))*sigmaz*vangin))};
Even after changing the notation of division from matrix
./
into scalar
/
it still produces the typical error. I want to know how exactly to calculate the matrix value of a function

4 件のコメント

KSSV
KSSV 2019 年 2 月 26 日
YOu have not defined many variables.....how do you expect us to help you?
Muhammad Waqi Azizi
Muhammad Waqi Azizi 2019 年 2 月 26 日
I've edited the code, added the variable which taken from handles as input text
Adam
Adam 2019 年 2 月 26 日
Using the debugger is by far the easiest way to solve problems like this. Just look at the sizes of the two sides of the ./ operator on command line and it should be obvious. We have no idea what size they are since you just convert a string to get them. I assume they aren't all scalars otherwise I would not expect such an error.
Stephen23
Stephen23 2019 年 2 月 26 日
編集済み: Stephen23 2019 年 2 月 26 日
"Even after changing the notation of division from matrix ./ into scalar /"
According to the MATLAB help thosee operators are actually:
See also:
Learning the difference between matrix and array operators is critical to using MATLAB.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

製品

リリース

R2016a

質問済み:

2019 年 2 月 26 日

編集済み:

2019 年 2 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by