Find the difference between two numbers in an array and create a new array

9 ビュー (過去 30 日間)
Ian Mason 2021 年 11 月 9 日
コメント済み: Ian Mason 2021 年 11 月 10 日
Hello, I am working on a meteoroogy project to calculate mean periods of buoyancy oscillation. Rather than do everything by hand, I figured it would be easier to throw them in matlab and have it calculate it. Right now, I'm at a point where I have calculated theta values in an array (11,1). For the equation I am using, I need to find the difference between theta values in order to use that number for my equation. (g/theta * differnece in Theta/difference in height)
All of these are in their own arrays. At this point, I need help figureing out what commands to use to have it figure out the difference between each of the theta values (and height, but I'm assuming I will end up just using the same code). I have attached the working code I have used to get each value so far.
One thing that can throw a wrench into my plans... there are two data sets that I have combined into one with a blank box in between them in order to split them apart. So I'll have to account for that, which will be a problem on its own. Thank you for your help!
pres = Table(: , 1);
hght = Table(: , 2);
temp = Table(: , 3);
dwpt = Table(: , 4);
rh = Table(: , 5);
mixr = Table(: , 6);
Rdcpdry = .286;
thing = Rdcpdry;
tp1 = (1000 ./ pres{: , 1}) .^thing;
theta = (temp{: , 1}) .* tp1;

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

採用された回答

Sargondjani 2021 年 11 月 9 日
d_theta=diff(theta);
2 件のコメントなしを表示なしを非表示
Ian Mason 2021 年 11 月 10 日
That was great! Thank you! Now I am running into issues calculing the d_hght. I'm trying to use the code d_hght = diff(hght);
But, I'm getting this error... Check for missing argument or incorrect argument data type in call to function 'diff'.
Ian Mason 2021 年 11 月 10 日
Figured it out. I forgot to put the call to the table in brackets.

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

カテゴリ

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

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by