Interpolation of scattered earthquake data
2 次查看(过去 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!