Surface between 3D lines

조회 수: 9 (최근 30일)
Talal Salem
Talal Salem 2019년 11월 19일
댓글: darova 2019년 11월 21일
Hi all,
I am trying to link these 3D lines through a surface that pass through all of them, which basically will show the variation between them and it would be great if that will be colored. I attached a pic that clarify my thoughts, and hopefully I will get help!
I tried to use the griddata command but unfortunately it didn't work.
I also attached my code and excel sheet I am working on.
Thanks,
clc
close all
clear all
dataset =xlsread('test.xlsx','N','G1:L203');
D1=dataset(:,2);
F1=dataset(:,1);
F2=dataset(:,3);
F3=dataset(:,5);
colormap hsv
figure(1)
plot (D1,F1,'MarkerSize',15);
hold on
plot (D1,F2,'-','MarkerSize',15);
plot (D1,F3,'--','MarkerSize',15);
hold off
z1=3*ones(201,1);
z2=6*ones(201,1);
z3=9*ones(201,1);
XX = [D1;D1;D1];
YY = [F1;F2;F3];
ZZ= [z1;z2;z3];
Dlin = linspace(min(D1),max(D1));
Flin = linspace(min(F1),max(F3));
Zlin = linspace(min(z1),max(z3));
[X,Y] = meshgrid(Dlin,Flin);
figure(2)
plot3(D1, z1, F1,'-.')
hold on
plot3(D1, z2, F2)
plot3(D1, z3, F3,'--')
grid on
figure(3)
Z= griddata(XX,YY,ZZ,X,Y);
plot3(X, Y, Z);
grid on
axis tight
view(-50,30)

채택된 답변

darova
darova 2019년 11월 20일
You are concatenating in a wrong way
XX = [D1 D1 D1];
YY = [F1 F2 F3];
ZZ = [z1 z2 z3];
surf(XX,ZZ,YY,'EdgeColor','none')
  댓글 수: 2
Talal Salem
Talal Salem 2019년 11월 21일
Thanks a lot that excatly what i was looking for!
darova
darova 2019년 11월 21일
Please accept the answer. Bigger reputation = more money

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by