WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

Vervielfältigung von Plots

 

demar
Forum-Fortgeschrittener

Forum-Fortgeschrittener


Beiträge: 56
Anmeldedatum: 18.03.09
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 05.03.2010, 23:44     Titel: Vervielfältigung von Plots
  Antworten mit Zitat      
Hallo...

Ich hoffe mir kann jemand helfen. Mein Quellcode sieht folgender Maßen aus:
Code:



function handle = koerper(coordinates,size,orientation,color8,transparency,LineOnOff)

    %
    %    c7---------c8
    %   /|          /|
    %  c3---------c4 |
    %  | |         | |
    %  | |         | |
    %  | c5--------c6
    %  | /         |/
    %  c1---------c2
    %

coordinates = [0,0,0] ;         %coordinates = [x,y,z]
size        = [1,2,3];          %size        = [sx,sy,sz]
orientation = [0,0,0];          %orientation = [alpha,beta,gamma]   0 <= alpha,beta,gamma <= 2*pi
color       = 'r';
transparency=1  ;               %transparency= t                    0 <= t <= 1    
LineOnOff   = 1;                %LineOnOff   = 1 (On)  or 0 (Off)

    %compute the 8 corners
    c1 = get3Dpoints(coordinates,[-size(1)/2;-size(2)/2;-size(3)/2],orientation);
    c2 = get3Dpoints(coordinates,[+size(1)/2;-size(2)/2;-size(3)/2],orientation);
    c3 = get3Dpoints(coordinates,[-size(1)/2;-size(2)/2;+size(3)/2],orientation);
    c4 = get3Dpoints(coordinates,[+size(1)/2;-size(2)/2;+size(3)/2],orientation);

    c5 = get3Dpoints(coordinates,[-size(1)/2;+size(2)/2;-size(3)/2],orientation);
    c6 = get3Dpoints(coordinates,[+size(1)/2;+size(2)/2;-size(3)/2],orientation);
    c7 = get3Dpoints(coordinates,[-size(1)/2;+size(2)/2;+size(3)/2],orientation);
    c8 = get3Dpoints(coordinates,[+size(1)/2;+size(2)/2;+size(3)/2],orientation);

    %plot the 6 sides
    hold on;
    handle(1) = fill3([c1(1) c2(1) c4(1) c3(1) ],[c1(2) c2(2) c4(2) c3(2) ],[c1(3) c2(3) c4(3) c3(3)],[color]);
    handle(2) = fill3([c2(1) c4(1) c8(1) c6(1) ],[c2(2) c4(2) c8(2) c6(2) ],[c2(3) c4(3) c8(3) c6(3)],[color]);
    handle(3) = fill3([c5(1) c6(1) c8(1) c7(1) ],[c5(2) c6(2) c8(2) c7(2) ],[c5(3) c6(3) c8(3) c7(3)],[color]);
    handle(4) = fill3([c1(1) c3(1) c7(1) c5(1) ],[c1(2) c3(2) c7(2) c5(2) ],[c1(3) c3(3) c7(3) c5(3)],[color]);
    handle(5) = fill3([c1(1) c2(1) c6(1) c5(1) ],[c1(2) c2(2) c6(2) c5(2) ],[c1(3) c2(3) c6(3) c5(3)],[color]);
    handle(6) = fill3([c3(1) c4(1) c8(1) c7(1) ],[c3(2) c4(2) c8(2) c7(2) ],[c3(3) c4(3) c8(3) c7(3)],[color]);

    %set transparency
    alpha(handle,transparency)
    %set LineStyle
    if LineOnOff == 0
        for cnt1 = 1:1:6
            set(handle(cnt1),'LineStyle','none');
        end
    end
   


function erg_coordinates = get3Dpoints(vec,coordinates,orientation);

    rot_mat = [...
                cos(orientation(1))*cos(orientation(2)),                  -cos(orientation(1))*sin(orientation(2)),                    sin(orientation(1));...
                cos(orientation(3))*sin(orientation(2))+sin(orientation(3))*sin(orientation(1))*cos(orientation(2)), cos(orientation(3))*cos(orientation(2))-sin(orientation(3))*sin(orientation(1))*sin(orientation(2)), -sin(orientation(3))*cos(orientation(1));...
                sin(orientation(3))*sin(orientation(2))-cos(orientation(3))*sin(orientation(1))*cos(orientation(2)), sin(orientation(3))*cos(orientation(2))+cos(orientation(3))*sin(orientation(1))*sin(orientation(2)),  cos(orientation(3))*cos(orientation(1))...
            ];

    erg_coordinates = (vec'+rot_mat*coordinates)';


 


Als Plot kommt ein Quader heraus Ich versuche seit ein paar Tagen den ganzen Körper in zum Beispiel x-Richtung zu vervielfältigen ohne, dass ich einen neue Variable
Zitat:
coordinates
definieren muss. Hat jemand eine Ahnung wie ich das machen kann?

Gruß Alex
Private Nachricht senden Benutzer-Profile anzeigen


Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2025 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.