Plot projection points after PCA analysis

조회 수: 1 (최근 30일)
monkey_matlab
monkey_matlab 2016년 10월 22일
답변: Image Analyst 2016년 10월 22일
I have these simple points:
X = [-0.7142;-1.7142;-1.7142;-0.7142;1.2857;1.2857;2.2857];
Y = [1.2857;0.2857;-0.7142;0.2857;0.2857;-0.7142;-0.7142];
I then found the projected points (using PCA) as
X_proj = [-2.2316; 0.0648; 1.044; -0.2725; -2.1535; 1.7647; 1.2005];
Y_proj = [2.8746; 3.4734; 1.5356; 1.5142; -2.4040; -1.4030; -2.3826];
I found the PCA axis as:
y1 = 0.2053*x1 + 0;
y2 = -0.48719*x2 + 0;
How can I show these points graphically on the two different planes?
Thanks.
  댓글 수: 1
monkey_matlab
monkey_matlab 2016년 10월 22일
Hello, How do I go about showing the original points and then the projected points on two different planes? Although the attached image is a little degraded, there are two planes:
Do I have to use a 3D plot then?

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2016년 10월 22일
(Regarding the image you added to clarify the post...) Why do you want them on different planes? Personally I think having two different marker shapes is fine. You could even give them different colors if you want. But I think plotting in 3D would just unnecessarily complicate it. But if you insist, you can do it with plot3()
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
%clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format short g;
format compact;
fontSize = 20;
x1 = 4*rand(1, 6) - 2;
y1 = 4*rand(1, 6) - 2;
x2 = 4*rand(1, 6) - 2;
y2 = 4*rand(1, 6) - 2;
% Plot set 1 as red * at plane z=0
z1 = zeros(1, length(x1));
plot3(x1, y1, z1, 'r*', 'MarkerSize', 8, 'LineWidth', 2);
% Plot set 2 as blue circles at plane z=1.5
z2 = 1.5 * ones(1, length(x2));
hold on; % Don't blow away set #1!
plot3(x2, y2, z2, 'bo', 'MarkerSize', 8, 'LineWidth', 2);
grid on;
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
zlabel('Z', 'FontSize', fontSize);

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 10월 22일
What is wrong with plot()?

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by