Calculating Change in 1 dimensional array

조회 수: 4 (최근 30일)
Stephanie Goldstein
Stephanie Goldstein 2014년 8월 22일
편집: Star Strider 2014년 8월 22일
Hello! I have a 1 dimensional array of latitude values (which has dimensions of 1 X 224). How would I calculate the change in latitude, aka delta latitude?
Thank you so much!

채택된 답변

Star Strider
Star Strider 2014년 8월 22일
If they are decimal values, use the diff function. Otherwise, you will have to convert them into decimal values (from degrees-minutes-seconds) first.
  댓글 수: 2
Stephanie Goldstein
Stephanie Goldstein 2014년 8월 22일
Alright, thank you!
Star Strider
Star Strider 2014년 8월 22일
My pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Image Analyst
Image Analyst 2014년 8월 22일
Subtract the two latitudes you want to calculate the difference between? Or am I missing something?
  댓글 수: 2
Stephanie Goldstein
Stephanie Goldstein 2014년 8월 22일
I need to calculate the difference between all of the latitudes in the array. For instance, I need to subtract the second from the first latitude, the third from the second latitude, and so on. Does that make sense?
Image Analyst
Image Analyst 2014년 8월 22일
That's what diff() does. Just make sure your angles are in decimal degrees or radians and not some kind of funky degrees/minutes/arcseconds form.

댓글을 달려면 로그인하십시오.


Stephanie Goldstein
Stephanie Goldstein 2014년 8월 22일
I need to calculate the difference between all of the latitudes in the array. For instance, I need to subtract the second from the first latitude, the third from the second latitude, and so on. Does that make sense?
  댓글 수: 4
Stephanie Goldstein
Stephanie Goldstein 2014년 8월 22일
Great. Thanks. How would I apply that function (used to convert to degrees) to the entire array and not to just one cell?
Star Strider
Star Strider 2014년 8월 22일
편집: Star Strider 2014년 8월 22일
According to the online documentation, the Mapping Toolbox has the dms2degrees function that does the same thing. I suggest you use it instead of the one I provided. (I don’t have the Mapping Toolbox, so just now thought to look.)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Geometric Geodesy에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by