Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
clc;
clear;
a=1;
b=3;
%wykresy
x1=[-5:0.5:5];
y1=a*x1+b;
s1='-- * r';
x2=[-2*pi:0.1:2*pi];
y2=sin(x2);
s2='- . g';
x3=[-5:0.1:5];
y3=[x3.^2];
s3='-. . b';
subplot(2,1,1);
plot(x1,y1,s1);
title('wykres1');
xlabel('Oś x');
ylabel('Oś y');
legend('y_1=ax+b');
text(-3,0,'alpha punkt(-3,0)');
grid;
subplot(2,1,2);
plot(x2,y2,s2,x3,y3,s3);
title('Wykres 2 i 3');
xlabel('Oś x');
ylabel('Oś y');
legend('y_2=sinx','y_3=x^2');
text(0,0,'beta punkt (0,0)');
grid;
axis([-2*pi 2*pi -2 2]);
***********K A L K U L A T O R********************************
clc;
clear;
dzialanie=input(['Wybierz działanie:' 'n1.Mnożenie' 'n2.Dzielenie' 'n3.Dodawanie' 'n4.Odejmowanie' 'n Wpisz odpowiedni numer: ']);
a=input('Wprowadź pierwszą liczbę: ');
b=input('Wprowadź drugą liczbę: ');
if dzialanie==1
disp(num2str(a*b));
elseif dzialanie==2
disp(num2str(a/b));
elseif dzialanie==3
disp(num2str(a+b));
elseif dzialanie==4
disp(num2str(a-b));
else
disp('Nie ma takiego działania');
end
//////////////////////////////////////////////////////////////////////////
clc;
clear;
dzialanie=input(['Wybierz działanie:' 'n1.Mnożenie' 'n2.Dzielenie' 'n3.Dodawanie' 'n4.Odejmowanie' 'nWpisz odpowiedni numer: ']);
switch dzialanie
case 1
a=input('Podaj pierwszą liczbę: ');
b=input('Podaj drugą liczbę: ');
disp(num2str(a*b));
case 2
a=input('Podaj pierwszą liczbę: ');
b=input('Podaj drugą liczbę: ');
disp(num2str(a/b));
case 3
a=input('Podaj pierwszą liczbę: ');
b=input('Podaj drugą liczbę: ');
disp(num2str(a+b));
case 4
a=input('Podaj pierwszą liczbę: ');
b=input('Podaj drugą liczbę: ');
disp(num2str(a-b));
otherwise
disp('Nie ma takeigo działania');
end
************K A L E N D A R Z******************************
clc;
clear;
miesiac=input('Podaj numer miesiąca: ');
if miesiac==1 || miesiac==3 || miesiac==5 || miesiac==7 || miesiac==8 || miesiac==11
disp(num2str(31));
elseif miesiac==4 || miesiac==6 || miesiac==9 || miesiac==10 || miesiac==12
disp(num2str(30));
elseif miesiac==2
disp(num2str(28));
else
disp('Podano nieprawidłowy numer')
end
////////////////////////////////////////////////////////////////////////////////
miesiac=input('Podaj numer miesiąca: ');
switch miesiac
case {1,3,5,7,8,11}
disp(num2str(31));
case {4,6,9,10,12}
disp(num2str(30));
case 2
disp(num2str(28));
otherwise
disp('Podano nieprawidłowy numer')
end
**********S I L N I A******************************************
clc;
clear;
n=input('Wprowadź liczbę, z której chcesz policzyć silnię: ');
silnia_for=1;
for k=1:n
silnia_for=silnia_for*k;
end
disp(['silnia_for=',num2str(silnia_for)]);
silnia_while=1;
k=1;
while k<=n
silnia_while=silnia_while*k;
k=k+1;
end
disp(['silnia_while=',num2str(silnia_while)]);
************S U M A od do**************************************
clc;
clear;
m=input('Wprowadź m: ');
n=input('Wprowadź n: ');
y=m;
suma_for=0;
suma_while=0;
for x=m:1:n
suma_for=suma_for+x;
end
disp(['suma_for=' num2str(suma_for)])
while y>=m && y<=n
suma_while=suma_while+y;
y=y+1;
end
disp(['suma_while=' num2str(suma_while)])
-------------------------------------------------------------------------------------------
%program który po nacisnieciu 1 tworzy wykres hiperboli a pood spodem paraboli, po nacisnieciu 2
%wykres sinus i cosinus, po nacisnieciu 3 uruchania kalkulator.
clc
clear
n=input('podaj numer');
switch n
case 1
subplot(2,1,1)
x=(-5:0.2:5);
a=2;
b=3;
c=12;
d=-5;
y=a*x.*x.*x+b*x.*x+c*x+d;
plot(x,y,'rd-')
xlabel('os x')
ylabel('os y')
legend('parabola')
text(-2,1,'parabola')
grid
subplot(2,1,2)
x2=(-2*pi:0.2:2*pi);
y2=sin(x2);
plot(x2,y2,'y*')
xlabel('os x')
ylabel('os y')
legend('y=sinx')
text(-2,0,'sinx')
grid
case 2
x=(-4*pi:0.2:4*pi);
x2=(-4*pi:0.2:4*pi);
y=cos(x);
y2=sin(x);
plot(x,y,'--*r',x2,y2,'-.g')
xlabel('os x')
ylabel('os y')
legend('cosinus','sinus')
text(-2,1,'sinus')
grid
case 3
a=input('podaj a');
b=input('podaj b');
znak=input('podaj znak + - * /','s');
switch znak
case '+'
suma=a+b;
disp(['suma wynosi ',num2str(suma)])
case '-'
roznica=a-b;
disp(['różnica wynosi ',num2str(roznica)])
case '*'
iloczyn=a*b;
disp(['iloczyn wynosi ',num2str(iloczyn)])
case '/'
iloraz=a/b;
disp(['suma wynosi ',num2str(suma)])
otherwise
disp('zly znak')
end
otherwise
disp('zla liczba')
end
![]() |
Notes.io is a web-based application for 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 12 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