Notes
![]() ![]() Notes - notes.io |
clear
disp('Autor programu: Radosław GOS')
disp('Program switch case')
disp('Dla funkcji kalendarza wpisz kalendarz lub KALENDARZ')
disp('Dla rysowania wykresów wpisz wykres lub WYKRES')
x=input('Podaj zmienną=','s');
switch x
case {'kalendarz','KALENDARZ'}
x=1:1:12;
y=[31,28,31,30,31,30,31,31,30,31,30,31];
plot (x,y,'.-k');
grid on;
title ('liczba dni w miesiącu')
case {'wykres','WYKRES'}
disp('Proszę podać liczbę');
disp('2 sinus i cosinus + zwykła')
disp('4 tangens i cotangens')
disp('7, 8 lub 9 dla współczynnika wzmocnienia')
y=input('Liczba= ');
switch y
case {2}
rodzaj=input('Wybierz stopnie lub radiany:','s');
e=input('od= ');
f=input('do= ');
a=input('a= ');
switch rodzaj
case 'stopnie'
x=(-4:0.1:4);
yi=a^.2+1;
h=(e:(f-e)/100:f);
subplot(1,2,2)
plot(h,sind(h),'-m',h,cosd(h),'-b');
legend('sin(x)','cos(x)');
grid on
xlabel('X')
ylabel('Y')
title('sinus i cosinus')
subplot(1,2,1)
plot(x,yi,'>r')
xlabel('X')
ylabel('Y')
title('liniowa')
grid on
case 'radiany'
x=(-4:0.1:4);
yi=a^.2+1;
z=(e:pi/20:f);
subplot(1,2,2);
plot(z,sin(z),'-m',z,cos(z),'-b');
title('Jeden wykres dla wszystkich');
legend('sin(x)','cos(x)');
grid on
xlabel('X')
ylabel('Y')
title('sinus i cosinus')
subplot(1,2,1)
plot(x,yi,'>r')
xlabel('X')
ylabel('Y')
title('liniowa')
grid on
otherwise
disp('podałeś niewłaściwą jednostkę')
end
case {4}
x3=(-2*pi:pi/100:2*pi);
x4=(-pi:pi/100:pi);
y3=tan(x3);
y4=cot(x4);
subplot(2,2,1)
plot(x3,y3,'-r');
text(2,5,'Punkt 1^alpha')
text(5,6,'Punkt 2_beta')
grid on
xlabel('X')
ylabel('Y')
title('funkcja tangens')
axis([-2*pi 2*pi -10 10]);
subplot(2,2,2)
plot(x4,y4,'-b');
axis([-pi pi -10 10]);
grid on
xlabel('X')
ylabel('Y')
title('funkcja cotangens')
otherwise
x9=(-5:0.1:5);
b=input('podaj b= ');
y9=x9-1;
subplot(1,2,1);
plot(x9,y9,'-r')
grid on
xlabel('X')
ylabel('Y')
title('Funkcja liniowa')
hold on
x10=-5:0.1:5;
y8=-x10+1;
subplot(1,2,2);
plot(x10,y8,'-b')
grid on
xlabel('X')
ylabel('Y')
title('Funkcja cosinus')
hold on
k=input('Wprowadź współczynnik wzmocnienia k= ');
y9=x9-1;
subplot(1,2,1);
plot(x9,y9,'--b')
legend('y9)','k*y9')
grid on
hold off
y8=-x10+1;
subplot(1,2,2);
plot(x10,y8,'--r')
grid on
legend('y8','k*y8')
hold off
end
end
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team