Clear Filters
Clear Filters

3 - d Graph in Matlab

1 view (last 30 days)
Chaklader Asfak
Chaklader Asfak on 27 Aug 2011
I need some help for making a graph. For example I had M-file :
clear all
[Num,Txt,Raw]=xlsread('Contour.xlsx');
a=Num(:,1);
b=Num(:,2);
c=Num(:,3);
d=Num(:,4);
e=Num(:,5);
f=Num(:,6);
figure(3);
plot3(c,b,a,'-+r',e,f,d,'--og')
grid on
xlim('auto')
ylim('auto')
zlim('auto')
xlabel('X')
ylabel('Y')
zlabel('Z')
hold on
k = reshape([3 2 1 5 6 4],3,[]);
arrayfun(@(i1)plot3(Num(i1,k(1,:)),Num(i1,k(2,:)),Num(i1,k(3,:))),1:size(Num,1))
Which makes the graph connecting all the points in a 3-d potting along the vertical axis with the Excel file : http://www.4shared.com/file/Gcoz8xa0/Contour.html
I WANT MAKE THE SAME FROM THIS EXCEL FILE AND M-FILE:
M-file:
clear all
[Num,Txt,Raw]=xlsread('LVK 3-D Graph_2.xls');
a=Num(:,1);
b=Num(:,2);
c=Num(:,3);
d=Num(:,4);
e=Num(:,5);
f=Num(:,6);
g=Num(:,7);
h=Num(:,8);
i=Num(:,9);
j=Num(:,10);
k=Num(:,11);
l=Num(:,12);
figure(1);
plot3(c,b,a,'-+r',e,f,d,'--og',i,h,g,'-+b', k,l,j,'-.xc')
grid on
xlim('auto')
ylim('auto')
zlim('auto')
xlabel('ZZP [° kw v.ct]')
ylabel('Air-fuel ratio []')
zlabel('p_mi [bar]')
title('ZZP [° KW v.OT] , Air-fuel ratio [] and p_mi 3-d plot ')
................................................................
I want to connect the points of (c,b,a)& (e,f,d) and (i,h,g) & (k,l,j)
The Excel file is here:
Hope you wont mind to help me :)
  1 Comment
Jan
Jan on 27 Aug 2011
Ok. You want to connect the mentioned points. And what does the posted code do? What do you wnat to be changed? Is there any problem in the first program you have posted? If not, it would be helpful if you remove it from the post.

Sign in to comment.

Answers (1)

Rick Rosson
Rick Rosson on 28 Aug 2011
You may want to consider the line function. For more information:
>> doc line
HTH.
Rick

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!