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

8 Ansichten (letzte 30 Tage)
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;

Akzeptierte Antwort

Sargondjani
Sargondjani am 9 Nov. 2021
d_theta=diff(theta);
  2 Kommentare
Ian Mason
Ian Mason am 10 Nov. 2021
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
Ian Mason am 10 Nov. 2021
Figured it out. I forgot to put the call to the table in brackets.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by