Interpolation of scattered earthquake data
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello all, I am currently new on matlab and now i trying to write a mat lab code that can interpolate my scattered earthquake data and produce a file that contains a continuous grid of data. I have an hypoDD.reloc (double difference file). the 3rd column is Longitude (Lo), the 2nd column is Latitude (Lt) while the 4th is depth of earthquake. Please how can I go about this?. i've make a script like this :
clc;
clear all;
data = load('hypodd.reloc');
x = data(:,3);
y = data(:,2);
z = data(:,4);
[xi,yi] = meshgrid(119:1:120, -3.2:1:-2.2);
zi = griddata(x,y,z,xi,yi);
surf(xi,yi,zi);
colorbar
title('\fontsize{14}Pemodelan 3D Hiposenter Gempa Bumi Sesudah Relokasi');
legend('Sesudah Relokasi',1);
xlabel('Longitude')
ylabel('Latitude')
zlabel('Depth in Kilometers')
but, i have another issue with the depth because Zi must be a regresssion cant be matrix or vector data. please help me. T__________T
I look forward to your response.
댓글 수: 1
Walter Roberson
2020년 10월 26일
Which release are you using? legend() has not permitted numeric entries for the positions for a fair number of years.
채택된 답변
Walter Roberson
2020년 10월 26일
[xi,yi] = meshgrid(119:1:120, -3.2:1:-2.2);
>> [min(x),max(x),min(y),max(y)]
ans =
119.18147 119.609587 -3.132489 -2.392441
Your query points are x = 119 and 120 exactly, and y = -3.2 and -2.2 . However, 119 is before the x data starts and 120 is after the x data ends, and -3.2 is before the y data starts and -2.2 is after the y data ends.
Therefore your four query points are all outside of the range of data stored in the data file, and therefore the griddedInterpolant returns NaN for all four points. Therefore your surf() ends up blank.
Note: in order for a surf plot to appear, somewhere in the range of data, there has to be at least a 2 x 2 sub-matrix of finite data.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Earthquake Engineering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
