Kokosza-iwp2016/zajęcia 6/main.tex

103 lines
1.9 KiB
TeX
Raw Normal View History

2016-11-21 00:54:08 +01:00
\documentclass[a4paper]{article}
%% Language and font encodings
\usepackage[utf8]{inputenc}
\usepackage{polski}
\usepackage[T1]{fontenc}
%% Sets page size and margins
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
%% Useful packages
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{dsfont}
\usepackage{geometry}
\usepackage{physics}
\usepackage{tikz}
\usepackage{pgfplots}
\newtheorem{definition}{Definicja}
\title{Wykresy}
\author{Andrzej Kokosza}
\begin{document}
\maketitle
\begin{tikzpicture}[scale=0.5,domain=-3.5:3.5,samples=300]
\draw[very thin,gray,dotted] (-4.9,-2.9) grid (4.9,9.9);
\draw[->,thick] (-5,0) -- (5,0) node[right]{$x$};
\draw[->,thick] (0,-3) -- (0,10) node[above]{$f(x)$};
\draw[red,thick] plot (\x,{\x^2-2*\x+3}) node[right] {$f(x) = x^2-2x+3$};
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
title=$\cos(2x)$,
xlabel={$x$},
ylabel={$y$},
axis lines=middle,
]
\addplot[
samples=100,
green,domain=-2*pi:2*pi,
]
{cos(2*deg(x))};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
title=$\sin(\tfrac{1}{x})$,
xlabel={$x$},
ylabel={$y$},
]
\addplot[
samples=3000,
blue,domain=-0.0005:0.0005,
]
{sin(1/x)};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
title=$x^2+y^2$,
xlabel={$x$},
ylabel={$y$},
zlabel={$z$},
colorbar left,
colormap/cool,
]
\addplot3[surf]{x^2+y^2};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
title=$x^2+y^2$,
xlabel={$x$},
ylabel={$y$},
zlabel={$z$},
colorbar horizontal,
view/h=60,
view/v=60,
colormap/bluered,
]
\addplot3[surf]{x^2-y^2+2*x*y^2+1};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}[scale=0.5]
\draw[very thin,gray,dotted] (-3.9,-2.9) grid (3.9,10);
\draw[->,thick] (-4,0) -- (4,0) node[right]{$x$};
\draw[->,thick] (0,-3) -- (0,10) node[above]{$f(x)$};
\draw plot file {./test.txt};
\end{tikzpicture}
\end{document}