How can I make 3d plots of planes by using spreadsheet in matlab

后端 未结 2 2018
南笙
南笙 2021-01-28 16:18
pointA=[9.62579 15.7309 3.3291];
pointB=[13.546  25.6869 3.3291];
pointC=[23.502  21.7667 -3.3291];
pointD=[19.5818 11.8107 -3.3291];

points=[pointA\' pointB\' pointC\'         


        
相关标签:
2条回答
  • 2021-01-28 16:43
    clear all, close all, clc
    pointA=rand(99,1);
    pointB=rand(99,1);
    pointC=rand(99,1);
    pointD=rand(99,1);
    pointAmat = reshape(pointA,3,1,[]);
    pointBmat = reshape(pointB,3,1,[]);
    pointCmat = reshape(pointC,3,1,[]);
    pointDmat = reshape(pointD,3,1,[]);
    
    points=[pointAmat pointBmat pointCmat pointDmat];
    
    for i = 1:size(points,3)
    fill3(points(1,:,i),points(2,:,i),points(3,:,i),'r')
    hold all
    end
    grid on
    alpha(0.3)
    

    Hope this helps.

    0 讨论(0)
  • 2021-01-28 16:55

    Assuming your data are a matrix, m = (400,3)

    m = rand(400,3); for i = 1:length(m); m2 = m'; % Transpose end

    Create a 3-D matrix in which 'j' represents each set of points:

    m3=[];
    

    %Not the most elegant way to cycle through every four points but it works!

    z = 0:(length(m2)/4); z1 = (z*4)+1; z1 = z1(:,1:length(z)-1); 
        for j = 1:length(z1);
            m3(:,:,j) = m2(:,z1(j):(z1(j)+3));
        end
    

    'j' now has a total length = 100 - representing the amount planes;

    fill3(m3(1,:,1),m3(2,:,1),m3(3,:,1),'r'); 
    

    % Cycle through planes- make a new figure for each plane;

    for j = 1:length(z1);
        fill3(m3(1,:,j),m3(2,:,j),m3(3,:,j),'r'); 
    end
    
    0 讨论(0)
提交回复
热议问题