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

10 次查看(过去 30 天)
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!
Table = readtable('file.xlsx');
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
Sargondjani 2021-11-9
d_theta=diff(theta);
  2 个评论
Ian Mason
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'.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by