Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
plotting surfaces

Subject: plotting surfaces

From: amarender

Date: 19 Jun, 2009 14:44:03

Message: 1 of 2

Hello all,
         I am having problem in drawing the surface,I want to draw the better surface to the one that is generated by the following code.I tried all 4 interpolation methods (Linear,cubic,nearest,V4) but they didn't worked for me. Can any body help me out????
Total code of my program is

clear
s=[ 5.377292075 0.074962583 40.27843522 1.40433E-05
2.250950211 0.904115233 19.16916178 2.35559E-06
4.329977143 0.343225832 38.42329041 1.02619E-05
4.254508568 0.356501622 36.56004981 1.00748E-05
5.758103385 0.190426021 47.32284538 1.24158E-05
4.131837484 0.190772162 34.96460117 1.24109E-05
6.890396431 0.148019097 34.37790404 1.30135E-05
8.15444975 0.097483698 49.36369289 1.37259E-05
5.464671717 0.187145347 41.60672213 1.2462E-05
5.446722734 0.272914708 34.6609775 1.1253E-05
2.579933907 0.72796699 21.85160951 4.83858E-06
3.309706309 0.543774779 25.16793912 7.43495E-06
5.763125418 0.233912559 43.24494862 1.18028E-05
5.355289487 0.233912559 40.47650974 1.18028E-05
7.863895535 0.179041216 41.67433616 1.25762E-05
7.154686201 0.120937875 47.01705761 1.33953E-05
7.905777481 0.099998949 46.78235633 1.36904E-05
8.243983982 0.087223003 47.12961751 1.38705E-05
7.480225104 0.067393711 48.29147831 1.415E-05
4.717374193 0.397620695 26.7955592 9.49514E-06
4.260290647 0.422060014 28.10009604 9.15064E-06
4.70159455 0.365823339 31.08951711 9.94335E-06
4.93942712 0.316758655 36.26668734 1.0635E-05
2.57445418 0.911633569 16.33063552 2.24961E-06
2.787282386 0.813931867 20.87453615 3.62682E-06
3.721707046 0.567267949 24.20301784 7.10379E-06
];
I4=s(:,1);
K4=s(:,2);
AE4=s(:,4);
t=s(:,3);
f=(((I4./AE4).^2).*(K4.^(3.5))).*(0.00635.^2)./260000;
x=I4;
y=K4;
z=f;
xlin = linspace(min(x),max(x),25);
ylin = linspace(min(y),max(y),25);
[X,Y] = meshgrid(xlin,ylin);
Z = griddata(x,y,z,X,Y,'linear');

subplot(2,2,1)
%figure
colormap(summer(256));
surf(X,Y,Z)
hidden off
hold on
plot3(x,y,z,'.','MarkerSize',25,'color','blue')
plot3(x,y,t,'*','Markersize',10,'color','red')
hold on
xlabel('Mixture Velocity,(m/s)'), ylabel('Concentration,(-)'), zlabel('Pressure Drop,(kPa/m)')
grid on
hold off


subplot(2,2,3)
plot3(x,y,z,'.','MarkerSize',25,'color','blue')
hold on
plot3(x,y,t,'*','Markersize',10,'color','red')
xlabel('Mixture Velocity,(m/s)'), ylabel('Concentration,(-)'), zlabel('Pressure Drop,(kPa/m)')
grid on
hold off


subplot(2,2,2)
plot3(x,y,z,'.','MarkerSize',25,'color','blue')
hold on
plot3(x,y,t,'*','Markersize',10,'color','red')
xlabel('Mixture Velocity,(m/s)'), ylabel('Concentration, (-)'), zlabel('Pressure Drop,(kPa/m)')
grid on
view(0,0)
hold off



subplot(2,2,4)
plot3(x,y,z,'.','MarkerSize',25,'color','blue')
hold on
plot3(x,y,t,'*','Markersize',10 ,'color','red')
xlabel('Mixture Velocity,(m/s)'), ylabel('Concentration,(-)'), zlabel('Pressure Drop,(kPa/m)')
grid on
view(90,0)
hold off



          Thanking you.

Subject: plotting surfaces

From: Luigi Giaccari

Date: 23 Jun, 2009 16:54:01

Message: 2 of 2

"amarender " <files@mathworks.com> wrote in message <h1g87j$45j$1@fred.mathworks.com>...
> Hello all,
> I am having problem in drawing the surface,I want to draw the better surface to the one that is generated by the following code.I tried all 4 interpolation methods (Linear,cubic,nearest,V4) but they didn't worked for me. Can any body help me out????
> Total code of my program is
>
> clear
> s=[ 5.377292075 0.074962583 40.27843522 1.40433E-05
> 2.250950211 0.904115233 19.16916178 2.35559E-06
> 4.329977143 0.343225832 38.42329041 1.02619E-05
> 4.254508568 0.356501622 36.56004981 1.00748E-05
> 5.758103385 0.190426021 47.32284538 1.24158E-05
> 4.131837484 0.190772162 34.96460117 1.24109E-05
> 6.890396431 0.148019097 34.37790404 1.30135E-05
> 8.15444975 0.097483698 49.36369289 1.37259E-05
> 5.464671717 0.187145347 41.60672213 1.2462E-05
> 5.446722734 0.272914708 34.6609775 1.1253E-05
> 2.579933907 0.72796699 21.85160951 4.83858E-06
> 3.309706309 0.543774779 25.16793912 7.43495E-06
> 5.763125418 0.233912559 43.24494862 1.18028E-05
> 5.355289487 0.233912559 40.47650974 1.18028E-05
> 7.863895535 0.179041216 41.67433616 1.25762E-05
> 7.154686201 0.120937875 47.01705761 1.33953E-05
> 7.905777481 0.099998949 46.78235633 1.36904E-05
> 8.243983982 0.087223003 47.12961751 1.38705E-05
> 7.480225104 0.067393711 48.29147831 1.415E-05
> 4.717374193 0.397620695 26.7955592 9.49514E-06
> 4.260290647 0.422060014 28.10009604 9.15064E-06
> 4.70159455 0.365823339 31.08951711 9.94335E-06
> 4.93942712 0.316758655 36.26668734 1.0635E-05
> 2.57445418 0.911633569 16.33063552 2.24961E-06
> 2.787282386 0.813931867 20.87453615 3.62682E-06
> 3.721707046 0.567267949 24.20301784 7.10379E-06
> ];
> I4=s(:,1);
> K4=s(:,2);
> AE4=s(:,4);
> t=s(:,3);
> f=(((I4./AE4).^2).*(K4.^(3.5))).*(0.00635.^2)./260000;
> x=I4;
> y=K4;
> z=f;
> xlin = linspace(min(x),max(x),25);
> ylin = linspace(min(y),max(y),25);
> [X,Y] = meshgrid(xlin,ylin);
> Z = griddata(x,y,z,X,Y,'linear');
>
> subplot(2,2,1)
> %figure
> colormap(summer(256));
> surf(X,Y,Z)
> hidden off
> hold on
> plot3(x,y,z,'.','MarkerSize',25,'color','blue')
> plot3(x,y,t,'*','Markersize',10,'color','red')
> hold on
> xlabel('Mixture Velocity,(m/s)'), ylabel('Concentration,(-)'), zlabel('Pressure Drop,(kPa/m)')
> grid on
> hold off
>
>
> subplot(2,2,3)
> plot3(x,y,z,'.','MarkerSize',25,'color','blue')
> hold on
> plot3(x,y,t,'*','Markersize',10,'color','red')
> xlabel('Mixture Velocity,(m/s)'), ylabel('Concentration,(-)'), zlabel('Pressure Drop,(kPa/m)')
> grid on
> hold off
>
>
> subplot(2,2,2)
> plot3(x,y,z,'.','MarkerSize',25,'color','blue')
> hold on
> plot3(x,y,t,'*','Markersize',10,'color','red')
> xlabel('Mixture Velocity,(m/s)'), ylabel('Concentration, (-)'), zlabel('Pressure Drop,(kPa/m)')
> grid on
> view(0,0)
> hold off
>
>
>
> subplot(2,2,4)
> plot3(x,y,z,'.','MarkerSize',25,'color','blue')
> hold on
> plot3(x,y,t,'*','Markersize',10 ,'color','red')
> xlabel('Mixture Velocity,(m/s)'), ylabel('Concentration,(-)'), zlabel('Pressure Drop,(kPa/m)')
> grid on
> view(90,0)
> hold off
>
>
>
> Thanking you.


http://giaccariluigi.altervista.org/blog/

http://www.mathworks.com/matlabcentral/fileexchange/22185

http://www.mathworks.com/matlabcentral/fileexchange/22595

http://www.mathworks.com/matlabcentral/fileexchange/23447

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us