14 Nowak Bartosz ćw3

background image

BARTOSZ NOWAK, GR. 14, ID, WIMiR

SPRAWOZDANIE Z ĆWICZEŃ NR. 3

DATA: 24.03.2009r

ZADANIE 1
disp(

'Mamy funkcje cos(a.*t+b).^5'

)

disp(

'Podaj t, od do'

)

od=input(

'od='

);

do=input(

'do='

);

a=input(

'Podaj a:'

);

b=input(

'Podaj b:'

);

t=[od:pi/50:do];

A=cos(a.*t+b).^5;

plot(t,A)

xlabel(

't'

);

ylabel(

'f(t)'

);

title(

'wykres cos(a.*t+b).^5'

);


WYNIK:

Mamy funkcje cos(a.*t+b).^5
Podaj t, od do
od=-1
do=2
Podaj a:-2
Podaj b:2
______________________________________________________________________________________________________
ZADANIE 2
clear

all

;

close

all

;

echo

off

all

;

okno=figure;

set(okno,

'color'

,[0.8,0.9,0.9]);

set(okno,

'inverthardcopy'

,

'on'

);

set(okno,

'MenuBar'

,

'none'

);

set(okno,

'Name'

,

'Ćwiczenia 3 Zadanie 2 MATLAB GUI'

);

set(okno,

'Numbertitle'

,

'off'

);

set(okno,

'Units'

,

'normalized'

)

set(okno,

'Position'

,[0.2,0.2,0.6,0.5]);

set(okno,

'Resize'

,

'on'

);

xy=axes(

'position'

,[0.3 0.3 0.6 0.6]);

title(

'cos^5(a.*t+b)'

);

xlabel(

't'

);

ylabel(

'wartosc funkcji'

);

uicontrol(

'style'

,

'text'

,

'position'

,[5 350 100 20],

'string'

,

'Podaj a:'

);

uicontrol(

'style'

,

'text'

,

'position'

,[5 300 100 20],

'string'

,

'Podaj b:'

);

uicontrol(

'style'

,

'text'

,

'position'

,[5 250 100 20],

'string'

,

'Zakres t od::'

);

uicontrol(

'style'

,

'text'

,

'position'

,[5 200 100 20],

'string'

,

'Zakres t do:'

);

a=4;

b=5;

od=-4;

do=4;

wykres=uimenu(

'label'

,

'Wykres'

);

rysuj=uimenu(wykres,

'label'

,

'Rysuj'

,

'callback'

,

't=[od:0.01:do];,plot(t,cos(a.*t+b).^5);,xlabel(x);,ylabel(y);,title(z)'

);

czysc=uimenu(wykres,

'label'

,

'Czysc'

,

'callback'

,

'cla'

);

a1=uicontrol(

'style'

,

'edit'

,

'position'

,[115 350 20 20],

'string'

,

'4'

,

'callback'

,

'a=str2double(get(a1,''string''));'

);

b1=uicontrol(

'style'

,

'edit'

,

'position'

,[115 300 20 20],

'string'

,

'5'

,

'callback'

,

'b=str2double(get(b1,''string''));'

);

od1=uicontrol(

'style'

,

'edit'

,

'position'

,[115 250 20 20],

'string'

,

'-4'

,

'callback'

,

'od=str2double(get(od1,''string''));'

);

do1=uicontrol(

'style'

,

'edit'

,

'position'

,[115 200 20 20],

'string'

,

'4'

,

'callback'

,

'do=str2double(get(do1,''string''));'

);

x=

't'

;

background image

y=

'wartosc funkcji'

;

z=

'wykres funkcji'

;

uicontrol(

'style'

,

'pushbutton'

,

'position'

,[5 5 100 50],

'string'

,

'Rysuj

wykres'

,

'callback'

,

't=[od:0.01:do];,plot(t,cos(a.*t+b).^5);,xlabel(x);,ylabel(y);,title(z)'

);

uicontrol(

'style'

,

'pushbutton'

,

'position'

,[125 5 100 50],

'string'

,

'Czysc wykres'

,

'callback'

,

'cla'

);


(zrzut ekranu)

ZADANIE3
clear

all

;

close

all

;

echo

off

all

;

okno=figure;

set(okno,

'MenuBar'

,

'none'

);

set(okno,

'Numbertitle'

,

'off'

);

set(okno,

'Units'

,

'normalized'

,

'position'

,[0.2 0.1 0.6 0.6]);

set(okno,

'name'

,

'Bartosz Nowak'

);

set(okno,

'resize'

,

'on'

);

set(okno,

'color'

,[0.5 0.9 1]);

frame1=uicontrol(

'style'

,

'frame'

,

'units'

,

'normalized'

,

'position'

,[0.01 0.9 0.98 0.08],

'visible'

,

'on'

);

frame2=uicontrol(

'style'

,

'frame'

,

'units'

,

'normalized'

,

'position'

,[0.01 0.8 0.98 0.08],

'visible'

,

'on'

);

frame3=uicontrol(

'style'

,

'frame'

,

'units'

,

'normalized'

,

'position'

,[0.01 0.02 0.98 0.1],

'visible'

,

'on'

);

frame1b1=uicontrol(

'style'

,

'pushbutton'

,

'units'

,

'normalized'

,

'position'

,[0.03 0.91 0.2 0.06],

'string'

,

'Wczytaj

plik'

,

'callback'

,

'[filename,pathname]=uigetfile(''*.jpg'');,set(frame1edit,''string'',strcat(pathname,filename));,obraz=imread(strcat(pathname

,filename));'

);

frame1edit=uicontrol(

'style'

,

'edit'

,

'units'

,

'normalized'

,

'position'

,[0.3 0.91 0.6 0.06]);

frame2axes1=axes(

'position'

,[0.1 0.5 0.25 0.25 ],

'visible'

,

'off'

);

frame2axes2=axes(

'position'

,[0.6 0.5 0.25 0.25 ],

'visible'

,

'off'

);

frame2axes3=axes(

'position'

,[0.1 0.2 0.25 0.25],

'visible'

,

'off'

);

frame2axes4=axes(

'position'

,[0.6 0.2 0.25 0.25],

'visible'

,

'off'

);

frame2edit=uicontrol(

'style'

,

'pushbutton'

,

'units'

,

'normalized'

,

'position'

,[0.03 0.81 0.2 0.06],

'string'

,

'Wyswietl obraz'

,

'callback'

,

'

R=obraz(:,:,1);,G=obraz(:,:,2);,B=obraz(:,:,3);,image(obraz,''parent'',frame2axes1),image(R,''parent'',frame2axes2),image(G,''parent'',frame2
axes3),image(B,''parent'',frame2axes4),set(frame2axes1,''visible'',''on''),set(frame2axes2,''visible'',''on''),set(frame2axes3,''visible'',''on''),se
t(frame2axes4,''visible'',''on'')'

);

background image

frame2txt1=uicontrol(

'style'

,

'text'

,

'units'

,

'normalized'

,

'position'

,[0.26 0.81 0.6 0.04],

'string'

,

'Kolejno wyświetlane obrazy: orginal, czerwony,

zielony, niebieski'

);

frame3txt1=uicontrol(

'style'

,

'text'

,

'units'

,

'normalized'

,

'position'

,[0.2 0.07 0.7 0.04],

'string'

,

'Program wczytuje obraz z dysku i wyswietla go

jako oryginał oraz warstwy RGB'

);

frame3txt2=uicontrol(

'style'

,

'text'

,

'units'

,

'normalized'

,

'position'

,[0.45 0.03 0.2 0.04],

'string'

,

'autor: Bartosz Nowak'

);

czysc=uicontrol(

'style'

,

'pushbutton'

,

'units'

,

'normalized'

,

'position'

,[0.45 0.15 0.1

0.08],

'string'

,

'Czysc'

,

'callback'

,

'cla(frame2axes1),cla(frame2axes2),cla(frame2axes3),cla(frame2axes4),set(frame2axes1,''visible'',''off''),set(f

rame2axes2,''visible'',''off''),set(frame2axes3,''visible'',''off''),set(frame2axes4,''visible'',''off'')'

);


Wyszukiwarka

Podobne podstrony:
14 Nowak Bartosz ćw9
Metoda magnetyczna MT 14
wyklad 14 15 2010
TT Sem III 14 03

więcej podobnych podstron