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

Dreieck in Koordinatensystem

 

try_and_error
Forum-Anfänger

Forum-Anfänger


Beiträge: 17
Anmeldedatum: 18.08.10
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 11.09.2010, 22:01     Titel: Dreieck in Koordinatensystem
  Antworten mit Zitat      
Hallo,

ich möchte dieses hier in Matlab wiedergeben:



Ist sowas in Matlab möglich? Ich weiß leider gar nicht, wo ich anfangen soll.

Danke schon mal,

try and error
Private Nachricht senden Benutzer-Profile anzeigen


lilov
Forum-Century

Forum-Century


Beiträge: 193
Anmeldedatum: 05.05.10
Wohnort: Bremerhaven
Version: ---
     Beitrag Verfasst am: 12.09.2010, 01:23     Titel:
  Antworten mit Zitat      
Hi,

hier ist der Code den du brauchst. Falls fragen sind kannst du schreiben.



Code:


figure1 = figure;


x1 = (1:6)';
leg1 = ones(6,1);
plot(x,cathetus1,'Linewidth',1.5)
axis([0 8 0 6])
hold on

x2 = ones(4,1).*6;
leg2 = (1:4)';
plot(x2,cathetus2,'Linewidth',1.5);

x3 = (1:6)';
hypotenuse = 3/5*x3+2/5;
plot(x3,hypotenuse,'Linewidth',1.5)

%% Labels
xlabel('x','FontWeight','bold','FontSize',12);


ylabel('y','FontWeight','bold','FontSize',12);



%% Textboxes

annotation(figure1,'textbox',...
    [0.448559670781891 0.47826267281106 0.0274348422496575 0.0645161290322581],...
    'String',{'d'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
annotation(figure1,'textbox',...
    [0.4238683127572 0.142857142857143 0.0891632373113855 0.0714285714285714],...
    'String',{'x_2-x_1'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
annotation(figure1,'textbox',...
    [0.179698216735254 0.153377880184332 0.094650205761317 0.0783410138248848],...
    'String',{'P_1=x_1/y_1'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
annotation(figure1,'textbox',...
    [0.716844993141286 0.408571428571429 0 begin_of_the_skype_highlighting              08571428571429 0      end_of_the_skype_highlighting.0891632373113855 0.0714285714285714],...
    'String',{'y_2-y_1'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
annotation(figure1,'textbox',...
    [0.722331961591219 0.640290322580645 0.094650205761317 0.0783410138248848],...
    'String',{'P_2=x_2/y_2'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');
 


Gruß,

lilov
Private Nachricht senden Benutzer-Profile anzeigen
 
try_and_error
Themenstarter

Forum-Anfänger

Forum-Anfänger


Beiträge: 17
Anmeldedatum: 18.08.10
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 12.09.2010, 01:51     Titel:
  Antworten mit Zitat      
Hey, danke, das sieht schon sehr gut aus!

Gibt nur noch einen kleinen Fehler irgendwo, der meckert nämlich wegen "unknown element" und zeigt den 2. Punkt nicht an.

Könntest du bitte nochmal draufschauen? Confused

Code:
figure1 = figure;


x1 = (1:6)';
leg1 = ones(6,1);
plot(x1,leg1,'Linewidth',1.5)
axis([0 8 0 6])
hold on

x2 = ones(4,1).*6;
leg2 = (1:4)';
plot(x2,leg2,'Linewidth',1.5);

x3 = (1:6)';
hypotenuse = 3/5*x3+2/5;
plot(x3,hypotenuse,'Linewidth',1.5)

%% Labels
xlabel('x','FontWeight','bold','FontSize',12);


ylabel('y','FontWeight','bold','FontSize',12);



%% Textboxes

annotation(figure1,'textbox',...
    [0.448559670781891 0.47826267281106 0.0274348422496575 0.0645161290322581],...
    'String',{'d'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
annotation(figure1,'textbox',...
    [0.4238683127572 0.142857142857143 0.0891632373113855 0.0714285714285714],...
    'String',{'x_2-x_1'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
annotation(figure1,'textbox',...
    [0.179698216735254 0.153377880184332 0.094650205761317 0.0783410138248848],...
    'String',{'P_1'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
annotation(figure1,'textbox',...
    [0.716844993141286 0.408571428571429 0.08571428571429 0.0891632373113855 0.0714285714285714],...
    'String',{'y_2-y_1'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
annotation(figure1,'textbox',...
    [0.722331961591219 0.640290322580645 0.094650205761317 0.0783410138248848],...
    'String',{'P_2'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');


Danke!
Private Nachricht senden Benutzer-Profile anzeigen
 
lilov
Forum-Century

Forum-Century


Beiträge: 193
Anmeldedatum: 05.05.10
Wohnort: Bremerhaven
Version: ---
     Beitrag Verfasst am: 12.09.2010, 02:13     Titel:
  Antworten mit Zitat      
hi,
hmmm ich wiess auch nicht was da los ist. Ich habe denselben Code und es läuft. nur wenn ich es von hier kopiere gibt er mir einen Fehler bei der dritten Notation an. Es könnte sein dass durch copy und paste von der webseite irgendwas schiefgeht. versuch deshalb die dritte Notation per Hand einzutippen. dann müsste es klappen. schick dir zur Sciherheit nochmal den Code:

Code:





figure1 = figure;


x1 = (1:6)';
leg1 = ones(6,1);
plot(x1,leg1,'Linewidth',1.5)
axis([0 8 0 6])
hold on

x2 = ones(4,1).*6;
leg2 = (1:4)';
plot(x2,leg2,'Linewidth',1.5);

x3 = (1:6)';
hypotenuse = 3/5*x3+2/5;
plot(x3,hypotenuse,'Linewidth',1.5)

%% Labels
xlabel('x','FontWeight','bold','FontSize',12);


ylabel('y','FontWeight','bold','FontSize',12);



%% Textboxes

annotation(figure1,'textbox',...
    [0.448559670781891 0.47826267281106 0.0274348422496575 0.0645161290322581],...
    'String',{'d'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
annotation(figure1,'textbox',...
    [0.4238683127572 0.142857142857143 0.0891632373113855 0.0714285714285714],...
    'String',{'x_2-x_1'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
annotation(figure1,'textbox',...
    [0.179698216735254 0.153377880184332 0.094650205761317 0.0783410138248848],...
    'String',{'P_1'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');


annotation(figure1,'textbox',...
    [0.716844993141286 0.408571428571429 0.0891632373113855 0.0714285714285714],...
    'String',{'y_2-y_1'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
annotation(figure1,'textbox',...
    [0.722331961591219 0.640290322580645 0.094650205761317 0.0783410138248848],...
    'String',{'P_2'},...
    'FontWeight','bold',...
    'FitBoxToText','off',...
    'LineStyle','none');
 


Gruß,
lilov
Private Nachricht senden Benutzer-Profile anzeigen
 
try_and_error
Themenstarter

Forum-Anfänger

Forum-Anfänger


Beiträge: 17
Anmeldedatum: 18.08.10
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 12.09.2010, 02:19     Titel:
  Antworten mit Zitat      
Danke, es funzt!
Private Nachricht senden Benutzer-Profile anzeigen
 
lilov
Forum-Century

Forum-Century


Beiträge: 193
Anmeldedatum: 05.05.10
Wohnort: Bremerhaven
Version: ---
     Beitrag Verfasst am: 12.09.2010, 02:22     Titel:
  Antworten mit Zitat      
übrigens,

du kannst deine plots sehr einfach auch interaktiv formatieren indem du über dem plot auf den button ganz recht klickst "Show Plot Tools and Dock Figure". falls das nicht schon angezeigt ist kannst du dann auf View->Figure Pallete dir die Figures anzeigen lassen. so kannst du dir manuell textboxes einfügen. und falls du später dir den code dazu ansehen willst kannst du unter File->Generate M-File dir den Code automatisch generieren lassen.

Gruß,

lilov
Private Nachricht senden Benutzer-Profile anzeigen
 
try_and_error
Themenstarter

Forum-Anfänger

Forum-Anfänger


Beiträge: 17
Anmeldedatum: 18.08.10
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 12.09.2010, 02:32     Titel:
  Antworten mit Zitat      
Wow cool, danke für die ganzen Tipps! Hab grad erst angefangen mit Matlab.. sehr nett von dir, danke! Very Happy
Private Nachricht senden Benutzer-Profile anzeigen
 
lilov
Forum-Century

Forum-Century


Beiträge: 193
Anmeldedatum: 05.05.10
Wohnort: Bremerhaven
Version: ---
     Beitrag Verfasst am: 12.09.2010, 02:35     Titel:
  Antworten mit Zitat      
Kein Problem, jeder von uns war mal da Smile Viel Glück!
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.