簡體   English   中英

使用Matlab發布3D圖

[英]publish 3d plot with matlab

我無法使用發布功能使用matlab報告3d圖。

當我運行代碼時,我可以正確地可視化這些圖,但是它們不會出現在使用命令publish獲得的已發布報告中。

我得到“空白圖”。

這是我的一段代碼。 我對網格圖有問題。

%% 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)

我認為這是因為您試圖在一個圖中繪制3個不同的3D圖。 只需將它們分解即可,例如:

mesh(d);

mesh(x1);

mesh(err);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM