092 matlab surface plot











############################# Video Source: www.youtube.com/watch?v=7hC7OLUE_dc

a systematical matlab plotting tutorial - 09.2/12 surface plot • ---- template ---- • https://discourse.sbufellows.com/t/ma... • clear; clf; • fid = fopen(['data/3D_surf_contour.dat'],'r') • Data = fscanf(fid,'%f',[3,inf]); • fclose(fid); • whos Data; % display the dimension of Data • Data=Data'; % row-wise to column-wise • % demonstrate the structure and contents of Data. • x=Data(:,2); y=Data(:,1); z=Data(:,3); • f1=figure(1); hold on; • set(f1,'renderer','zbuffer'); % memory problem; use before plotting complex plots • plot3(x,y,z,'.'); % plot data as it is, no surf, no contour, not pretty. • view([-20 30]); grid on; • view(0,90); • view(0,0); view(90,0) • % Now, let build continuous surface or contour from these scattered dots. • % build vectors • v_x=linspace(1,100,50); • v_y=linspace(1,100,50); • % build grid • [xx,yy]=meshgrid(v_x,v_y); mesh(xx,yy,ones(50,50)) • % interpolate scattered data onto a grid • zz = griddata(x,y,z,xx,yy); • • • f2=figure(2); clf; hold on; • set(f2,'renderer','zbuffer'); • surf(xx,yy,zz); • shading flat; • view(-20,50) % surface plot • grid on; • -----Data file: 3D_surf_contour.dat (part only) ----- • 1 9 9.45632 • 1 10 9.55776 • 1 11 9.88573 • 1 12 9.94265 • 1 13 9.75236 • 1 14 9.89095 • 1 15 9.88681 • 1 16 8.92979 • 2 5 9.771 • 2 6 8.6279 • 2 7 8.15065 • 2 8 7.50266 • 2 9 7.21216 • 2 10 6.93484

#############################









Content Report
Youtor.org / Youtor.org Torrents YT video Downloader © 2024

created by www.mixer.tube