曲面插补曲线 [英] interpolation curve to surface

查看:77
本文介绍了曲面插补曲线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个插值问题: 我有一个函数z = z(x,y),我知道x和y之间的关系,例如x = f(y,x_0).在此,x_0是时间y = 0上曲线的起点.假设x_0 = [0 1 2]具有三个值.对于x_0的每个值,我在R ^ 2中获得一条曲线.x1 = f1(y),x2 = f2(y)和x3 = f3(y),然后使用(绘制在R ^ 3中的z1,z2,z3曲线x1,f1),(x2,f2)和(x3,f3).如何对z1,z2、23进行插值以获得曲面? 我将不胜感激, 毫克

This is a interpolation problem: I have a function z=z(x,y) and I know the relationship between x and y like x=f(y,x_0). Here x_0's are starting points of curves on time y=0. Let's assume x_0=[0 1 2] has three values. For each value of x_0, I get a curve in R^2.x1=f1(y),x2=f2(y) and x3=f3(y) and I draw z1,z2,z3 curves in R^3 using (x1,f1), (x2,f2) and (x3,f3). How can I interpolate z1,z2,23 for getting a surface? I will be grateful for any help, mgm

推荐答案

使用您的符号,以及x = f(x0,y)和z = f(x,y)的一些任意示例关系,这就是您的工作方式它(我还添加了直接计算的图表以供参考):

Using your notation, and some arbitrary example relationships for x = f(x0, y) and z = f(x,y), this is how you do it (I also added a plot of the direct calculation for reference):

% Define grid
x0_orig = 0:2;
y_orig  = 0:3;
[x0, y] = meshgrid(x0_orig, y_orig);

% Calculate x (replace the relationship with your own)
x = x0 + 0.1 * y.^2;

% Calculate z (replace the relationship with your own)
z = 0.1 * (x.^2 + y.^2);

% Plot
subplot(1,3,1)
surf(x, y, z)
xlabel('x')
ylabel('y')
zlabel('z')
title('Original data')

%%%%%%%%%%
% Interpolate with finer grid
x0i = 0:0.25:2;
yi  = 0:0.25:3;

xi = interp2(x0_orig, y_orig, x, x0i, yi');
[x0i yi] = meshgrid(x0i, yi);
zi = interp2(x0, y, z, x0i, yi);

subplot(1,3,2)
surf(xi, yi, zi);
title('Interpolated data')

%%%%%%%%%%
% Recalculate directly with finer grid
x0i = 0:0.25:2;
yi  = 0:0.25:3;

[x0i yi] = meshgrid(x0i, yi);
xi = x0i + 0.1 * yi.^2;
zi = 0.1 * (xi.^2 + yi.^2);

subplot(1,3,3)
surf(xi, yi, zi)
title('Recalculated directly')

这篇关于曲面插补曲线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆