简体   繁体   English

使用Matlab发布3D图

[英]publish 3d plot with matlab

I am not able to report 3d plot with matlab using the function publish. 我无法使用发布功能使用matlab报告3d图。

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. 当我运行代码时,我可以正确地可视化这些图,但是它们不会出现在使用命令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. 我认为这是因为您试图在一个图中绘制3个不同的3D图。 Just break them out, eg: 只需将它们分解即可,例如:

mesh(d);

mesh(x1);

mesh(err);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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