简体   繁体   中英

publish 3d plot with matlab

I am not able to report 3d plot with matlab using the function publish.

When I run the code I can correctly visualize the plots but they do not appear in the published report obtained using the command publish.

I obtain "blank plot".

Here there is a piece of my code. I have problem with the mesh plot.

%% 2.A 
clear all
clc
load('Ex2.mat')


[d,m,s]=pca_normalise(X);
[pc,t,VE]=pca_nipals(d,20);

% the first and the second PC explain more than 98 % of the variance
% so we will consider only this 2 components while looking for patterns.
VE(1:4)
figure
scatter(t(:,1),t(:,2))
axis('equal')
%%  2.B  
% using 1 PC
[d,m,s]=pca_normalise(X);
[pc,t,VE]=pca_nipals(d,1);
x1=t*pc';
disp('approximation error using only 1 PC')
norm(d-x1)
err=d-x1;
err=err.^2;

figure
mesh(d,x1,err)

%% 2.C 
%using 2 PC
[pc2,t2,VE2]=pca_nipals(d,2);
x2=t2*pc2';

disp('approximation error using 2 PCs')
norm(d-x2)

err2=d-x2;
err2=err2.^2;

figure
mesh(X,x2,err2)

I think it's because you're trying to plot 3 different 3-d plots in one. Just break them out, eg:

mesh(d);

mesh(x1);

mesh(err);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM