Units in grating effect code

1 回表示 (過去 30 日間)
Dylan Reay-Bennett
Dylan Reay-Bennett 2021 年 8 月 28 日
回答済み: Shanmukha Voggu 2021 年 8 月 31 日
Hi, Hope every one is good.
So I am using matlab to predict the effects of a diffuser. I am using this code to input the diffusor and signal data:
v=343;
f=1000;
k=2*pi*f/v;
d=3;
N=12;
n=1:N;
height=[0,1,4,9,5,3,3,5,9,4,1,0,];
I am slightly confused as to units.
v = speed of sound (m)
f = frequency (Hz)
my issue is d = distance between wells (?) and the height of the wells (?) and what units are being used in the calculations. I am getting results but to accurately make assumptions i could do with knowing if matlab will be assuming cm or inch.
Any help appreciated,
Cheers
  1 件のコメント
darova
darova 2021 年 8 月 29 日
It's you should know what units you have. MATLAB operaes only with numbers, it doesn't care about units

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

回答 (1 件)

Shanmukha Voggu
Shanmukha Voggu 2021 年 8 月 31 日
Hi Dylan,
let's take a variable "d"(distance),
d=3000; %it is stored as double by default(No additional info about any units of d).
Assume a situation, the above distance is in meters according to you. if you want to work on kilometers as a unit, you have to assign in this way manually
d=3; %as 3000m = 3km, d is stored as double by default(No additional info about any units of d) you have to do it manually.
There is a way to use symbolic units, refer to this for more information.

カテゴリ

Help Center および File ExchangeAudio Processing Algorithm Design についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by