Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   
Bücher:

Studierende:
Praktikant Toolentwicklung Matlab (m/w)
Branche: Beratung, Expertise, Fahrzeugtechnik, Fahrzeugteile, Technische Dienstleistungen
MBtech Group GmbH & Co. KGaA - Fellbach

Abschlussarbeit / Praktikum: Entwicklung Matlab (m/w)
Branche: Informationstechnologie, Elektrotechnik, Elektronik
GIGATRONIK Technologies GmbH - Ulm

Studentische Mitarbeit - Fahrzeugmessungen
Branche: mehrere
IAV GmbH - Ingenieurgesellschaft Auto und Verkehr - Berlin

Werkstudent (m/w) High End GNSS Simulation mit modernsten Signalgeneratoren
Branche: Mess-, Regel-, Automatisierungstechnik, Telekommunikation, Nachrichtentechnik
ROHDE & SCHWARZ GmbH & Co. KG - München

Praktikant Testsystemaufbau (m/w)
Branche: Beratung, Expertise, Fahrzeugtechnik, Fahrzeugteile, Technische Dienstleistungen
MBtech Group GmbH & Co. KGaA - Sindelfingen

weitere Angebote

Partner:


Vermarktungspartner


Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

Farbtabelle

 

brummfritz
Forum-Anfänger

Forum-Anfänger


Beiträge: 20
Anmeldedatum: 01.09.16
Wohnort: Düsseldorf
Version: Matlab R2015b
     Beitrag Verfasst am: 21.06.2017, 21:07     Titel: Farbtabelle
  Antworten mit Zitat      
Mit dem folgenden Script kann eine eigene Farbtabelle erstellt werden.

Code:
mclose('all');
clear
zi=struct('x',0);
///////////////////////////////////////////////////////////////////////////////////////////////////////////
function [zi]=mach(zi)
    if zi.u3.value<zi.u2.value then
        zi.u3.value=zi.u2.value
    end
    if zi.u4.value<zi.u3.value then
        zi.u4.value=zi.u3.value
    end
    if zi.u5.value<zi.u4.value then
        zi.u5.value=zi.u4.value
    end
//
    if zi.u8.value<zi.u7.value then
        zi.u8.value=zi.u7.value
    end
    if zi.u9.value<zi.u8.value then
        zi.u9.value=zi.u8.value
    end
    if zi.u10.value<zi.u9.value then
        zi.u10.value=zi.u9.value
    end
    //
    if zi.u13.value<zi.u12.value then
        zi.u13.value=zi.u12.value
    end
    if zi.u14.value<zi.u13.value then
        zi.u14.value=zi.u13.value
    end
    if zi.u15.value<zi.u14.value then
        zi.u15.value=zi.u14.value
    end
    //
i1=zi.u1.value;
i2=zi.u2.value;
i3=zi.u3.value;
i4=zi.u4.value;
i5=zi.u5.value;
//
i6=zi.u6.value;
i7=zi.u7.value;
i8=zi.u8.value;
i9=zi.u9.value;
i10=zi.u10.value;
//
i11=zi.u11.value;
i12=zi.u12.value;
i13=zi.u13.value;
i14=zi.u14.value;
i15=zi.u15.value;
//
// 1.
if i1==0 then
    x(1:i2)=zeros(i2);
    x(i2:i3)=0:1/(i3-i2):1;
    x(i3:i4)=ones(i4-i3);
    x(i4:i5)=1:-1/(i5-i4):0;
    x(i5:2998)=zeros(2998-i4);
    zi.x=x;
else
// 2.
    x(1:i2)=ones(i2);
    x(i2:i3)=1:-1/(i3-i2):0;
    x(i3:i4)=zeros(i4-i3);
    x(i4:i5)=0:1/(i5-i4):1;
    x(i5:2998)=ones(2998-i4);
    zi.x=x;
end
/////////////////////////////////////////////////
// 1.
if i6==0 then
    y(1:i7)=zeros(i7);
    y(i7:i8)=0:1/(i8-i7):1;
    y(i8:i9)=ones(i9-i8);
    y(i9:i10)=1:-1/(i10-i9):0;
    y(i10:2998)=zeros(2998-i10);
    zi.y=y;
else
// 2.
    y(1:i7)=ones(i7);
    y(i7:i8)=1:-1/(i8-i7):0;
    y(i8:i9)=zeros(i9-i8);
    y(i9:i10)=0:1/(i10-i9):1;
    y(i10:2998)=ones(2998-i10);
    zi.y=y;
end
/////////////////////////////////////////////////////
// 1.
if i11==0 then
    z(1:i12)=zeros(i12);
    z(i12:i13)=0:1/(i13-i12):1;
    z(i13:i14)=ones(i14-i13);
    z(i14:i15)=1:-1/(i15-i14):0;
    z(i15:2998)=zeros(2998-i15);
    zi.z=z;
else
// 2.
    z(1:i12)=ones(i12);
    z(i12:i13)=1:-1/(i13-i12):0;
    z(i13:i14)=zeros(i14-i13);
    z(i14:i15)=0:1/(i15-i14):1;
    z(i15:2998)=ones(2998-i15);
    zi.z=z;
end
///////////////////////////////////////////////////
zi.cm(1:1000,1)=zi.x(1000:1999);
zi.cm(1:1000,2)=zi.y(1000:1999);
zi.cm(1:1000,3)=zi.z(1000:1999);
zi.f.color_map=zi.cm;
//////////////////////////////////////////////////
scf(zi.f)
    delete(zi.h1);
    delete(zi.h2);
    delete(zi.h3);
subplot(6,2,2);
plot(zi.cm(:,1),'thickness',3);
zi.h1=gce();
//
subplot(6,2,6);
plot(zi.cm(:,2),'thickness',3);
zi.h2=gce();
//
subplot(6,2,10);
plot(zi.cm(:,3),'thickness',3);
zi.h3=gce();

zi.x=1;
///////////////////////////////////////////////
endfunction
//////////////////////////////////////
function [zi]=anfang(zi)
//
//scf(zi.f);
zi.u1.value=0;
//
zi.u2.value=1360;
zi.u3.value=1599;
zi.u4.value=1879;
zi.u5.value=2149;
//
zi.u6.value=0;
zi.u7.value=1129;
zi.u8.value=1359;
zi.u9.value=1649;
zi.u10.value=1869;
//
zi.u11.value=0;
zi.u12.value=800;
zi.u13.value=1099;
zi.u14.value=1399;
zi.u15.value=1829;
//
[zi]=mach(zi)
endfunction
////////////////////////////////////////////////////////////////////
function [zi]=speicher(zi)
    cm=zi.cm;
    zo=uiputfile('*.dat','D:\Scilab\')
    save(zo+'.dat','cm');
endfunction
///////////////////////////////////////////////////////////////////
function [zi]=lade(zi)
    [zi.dateiname,zi.pfad]=uigetfile('*.dat','D:\Scilab\');    //WAV Datei wählen
    fi=zi.pfad+'\'+zi.dateiname;
    load(fi,'cm');
    zi.cm=cm;
    zi.f.color_map=zi.cm;
endfunction
/////////////////////////////
// formular
d(1,1:20)=zeros(20);
d(1,21)=ones(20)*1000;
d(1,22:50)=zeros(20);
d(2,:)=d(1,:);
for i=2:20
    d(i,:)=d(1,:);
end
//////////////////
zi.cm=jetcolormap(1000);
m=size(d);
subplot(1,2,1);
[xx,yy,zz]=genfac3d(1:m(1),1:m(2),d());
plot3d(xx,yy,list(zz,zz),theta=-20,alpha=16,flag=[-1,2,2]);
//
zi.f=gcf();
zi.f.color_map=jetcolormap(1000);
    zi.f.visible = "on";
    zi.f.figure_position = [10,10];
    zi.f.figure_size = [1400,900];
    zi.f.figure_name='Farbtabelle';
/////////////////////////////////
//
//
a=gca();
a.visible = "on";
a.axes_visible = ["on","on","on"];
a.axes_reverse = ["on","off","off"];
a.auto_ticks = ["off","off","off"];

a.grid = [1,1,1];
a.grid_thickness = [1,1,1];
a.grid_style = [1,1,1];
a.grid_position = "background";

a.title.font_size=2;
a.title.text='Farbtabelle';
a.x_label.font_size=2;
a.x_label.text="Sekunden";
a.x_label.visible="on";
a.y_label.font_size=2;
a.y_label.text="Frequenz";
a.y_label.visible="on";
a.z_label.font_size=2;
a.z_label.text="Amplitude";
a.z_label.visible="on";

a.auto_scale="off";
// sekundenachse
a.x_ticks=tlist(['locations','labels'],[1,40,80,120,160,200,240,280,320,360,400,440,480,520,560,600,640,680,720,760,800,840,880,920,960,1000,1040,1080,1120,1160,1200,1240,1280,1320,1360,1400,1440,1480,1520,1560,1600,1640,1680,1720,1760,1800,1840,1880,1920,1960,2000],["0","10","20","30","40","50","60","70","80","90","100","110","120","130","140","150","160","170","180","190","200","210","220","230","240","250","260","270","280","290","300","310","320","330","340","350","360","370","380","390","400","410","420","430","440","450","460","470","480","490","500"]);
// frequenzaschse
a.y_ticks=tlist(['locations','labels'],[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,400,410,420,430,440,450,460,470,480,490,500],["0","10","20","30","40","50","60","70","80","90","100","110","120","130","140","150","160","170","180","190","200","210","220","230","240","250","260","270","280","290","300","310","320","330","340","350","360","370","380","390","400","410","420","430","440","450","460","470","480","490","500"]);
// amplitudenachse
a.z_ticks=tlist(['locations','labels'],[0,100,200,300,400,500,600,700,800,900,1000],["0","100","200","300","400","500","600","700","800","900","1000"]);

a.sub_tics=[9,9,9];

a.box = "back_half";
//a.background = color(255,248,220);
a.background = -2;
a.tight_limits = ["on","off","off"];
a.cube_scaling = "on";
a.isoview = "off";
a.rotation_angles = [80,44];
// mit den folgenden einstellungen der drei achsen kann die Anzeige angepasst werden
/////////////////////////////////////////////////////////////////////////////
zh=a.data_bounds;
// zeitachse
//zh(1,1)=1;
//zh(2,1)=199;
// frequenzachse
//zh(1,2)=0;
// amplitudenachse
zh(1,3)=0;
zh(2,3)=1000;
a.data_bounds =zh;
//
/////////////////////////////////////////////////////////////////////////////
//
zi.u1=uicontrol(zi.f,"style","radiobutton", 'position', [880 600 30 30],'HorizontalAlignment','center','callback','');
zi.u2=uicontrol(zi.f,"style","spinner", 'position', [930 600 60 30],'HorizontalAlignment','center','min',1,'max',2998,'SliderStep',[1,1],'callback','');
zi.u3=uicontrol(zi.f,"style","spinner", 'position', [1010 600 60 30],'HorizontalAlignment','center','min',1,'max',2998,'SliderStep',[1,1],'callback','');
zi.u4=uicontrol(zi.f,"style","spinner", 'position', [1090 600 60 30],'HorizontalAlignment','center','min',1,'max',2998,'SliderStep',[1,1],'callback','');
zi.u5=uicontrol(zi.f,"style","spinner", 'position', [1170 600 60 30],'HorizontalAlignment','center','min',1,'max',2998,'SliderStep',[1,1],'callback','');
//
zi.u6=uicontrol(zi.f,"style","radiobutton", 'position', [880 340 30 30],'HorizontalAlignment','center','callback','');
zi.u7=uicontrol(zi.f,"style","spinner", 'position', [930 340 60 30],'HorizontalAlignment','center','min',1,'max',2998,'SliderStep',[1,1],'callback','');
zi.u8=uicontrol(zi.f,"style","spinner", 'position', [1010 340 60 30],'HorizontalAlignment','center','min',1,'max',2998,'SliderStep',[1,1],'callback','');
zi.u9=uicontrol(zi.f,"style","spinner", 'position', [1090 340 60 30],'HorizontalAlignment','center','min',1,'max',2998,'SliderStep',[1,1],'callback','');
zi.u10=uicontrol(zi.f,"style","spinner", 'position', [1170 340 60 30],'HorizontalAlignment','center','min',1,'max',2998,'SliderStep',[1,1],'callback','');
//
zi.u11=uicontrol(zi.f,"style","radiobutton", 'position', [880 70 30 30],'HorizontalAlignment','center','callback','');
zi.u12=uicontrol(zi.f,"style","spinner", 'position', [930 70 60 30],'HorizontalAlignment','center','min',1,'max',2998,'SliderStep',[1,1],'callback','');
zi.u13=uicontrol(zi.f,"style","spinner", 'position', [1010 70 60 30],'HorizontalAlignment','center','min',1,'max',2998,'SliderStep',[1,1],'callback','');
zi.u14=uicontrol(zi.f,"style","spinner", 'position', [1090 70 60 30],'HorizontalAlignment','center','min',1,'max',2998,'SliderStep',[1,1],'callback','');
zi.u15=uicontrol(zi.f,"style","spinner", 'position', [1170 70 60 30],'HorizontalAlignment','center','min',1,'max',2998,'SliderStep',[1,1],'callback','');
//Neu
zi.u16=uicontrol(zi.f,"style","pushbutton", 'position', [990 10 60 30],'string','Lade','callback','[zi]=lade(zi)');
zi.u17=uicontrol(zi.f,"style","pushbutton", 'position', [1130 10 60 30],'string','Mach','callback','[zi]=mach(zi)');
zi.u18=uicontrol(zi.f,"style","pushbutton", 'position', [1060 10 60 30],'string','Start','callback','[zi]=anfang(zi)');
zi.u19=uicontrol(zi.f,"style","pushbutton", 'position', [1200 10 60 30],'string','Save','callback','[zi]=speicher(zi)');
zi.u20=uicontrol(zi.f,"style","pushbutton", 'position', [1300 10 60 30],'string','Exit','callback','close');
zi.u21=uicontrol(zi.f,"style","text",'HorizontalAlignment','center' ,'position', [780 600 80 30],'string','Rot');
zi.u22=uicontrol(zi.f,"style","text",'HorizontalAlignment','center' ,'position', [780 340 80 30],'string','Grün');
zi.u23=uicontrol(zi.f,"style","text",'HorizontalAlignment','center' ,'position', [780 70 80 30],'string','Blau');
//
zi.u1.value=0
//
zi.u2.value=1360;
zi.u3.value=1599;
zi.u4.value=1879;
zi.u5.value=2149;
//
zi.u6.value=0;
zi.u7.value=1129;
zi.u8.value=1359;
zi.u9.value=1649;
zi.u10.value=1869;
//
zi.u11.value=0;
zi.u12.value=800;
zi.u13.value=1099;
zi.u14.value=1399;
zi.u15.value=1829;
////////////////////////////////////////////
subplot(6,2,2);
plot(zi.cm(:,1),'thickness',3);
zi.h1=gce();
zi.h1a=gca();
//
subplot(6,2,6);
plot(zi.cm(:,2),'thickness',3);
zi.h2=gce();
zi.h2a=gca();
//
subplot(6,2,10);
plot(zi.cm(:,3),'thickness',3);
zi.h3=gce();
zi.h3a=gca();

 
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
.


goMatlab ist ein Teil des goForen-Labels
goForen.de goMATLAB.de goLaTeX.de goPCB.de


 Impressum  | Nutzungsbedingungen  | Datenschutz  | Werbung/Mediadaten | Studentenversion | FAQ | goMatlab RSS Button RSS


Copyright © 2007 - 2017 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks
Partner: LabVIEWforum.de

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.