I'm having some problems drawing ellipse in tikz. Can someone help(show) me, how I can make a graph like this?
I hope someone. could lead me on the way.
- I can not find out to make some area a color, like between "a" and "b".
- And the cylinder between "x_0" and "x" with the Oblique lines.
- I can not find out to make half of the ellipse dashed like around "a"
My code so far:
\documentclass[a4paper,10pt,twoside]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{pgf}
\usepackage{amsmath,amssymb}
\usetikzlibrary{arrows,tikzmark}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols}
\begin{document}
\begin{center}
\begin{minipage}[t]{0,45\textwidth}\centering
%\vspace{1cm}
\definecolor{cqcqcq}{rgb}{0.55,0.55,0.9}
\definecolor{gitter}{rgb}{0.65,0.65,0.65}
\centering
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.5cm,y=0.5cm, scale=1]
%\draw [color=gitter, xstep=0.5cm,ystep=0.5cm] (-5,-1) grid (5,10); % Grid område
\draw[->,color=black, line width=1pt] (-5,0) -- (15,0); %X-akse
%\draw[color=black] (-2,0) node[below] {\fontsize{7}{7}$\textbf{-2}$}; % -2 på xaksen
\draw[color=black] (10,-0.4) node[below] {\fontsize{12}{12}$\textbf{b}$}; % b på xaksen
\draw[color=black] (-3,-0.4) node[below] {\fontsize{12}{12}$\textbf{a}$}; % a på xaksen
\draw[color=black] (15,0) node [anchor=west] {\fontsize{7}{7} \text{(1)}}; %Aksenanvn
\draw[->,color=black, line width=1pt] (0,-10) -- (0,10); %Y-akse
\draw[color=black] (0,11.3) node [anchor=north] {\fontsize{7}{7} \text{(2)}}; % Aksenavn
\clip(-5,-10) rectangle (15,10);
\draw[smooth,samples=100,domain=-5:15, line width=1pt, color=blue] plot(\x,{0.002*(\x)^3-0.02*(\x)+0.25*(\x)+4});
\draw[smooth,samples=100,domain=-3:10, line width=1pt, color=blue] plot(\x,{-0.002*(\x)^3+0.02*(\x)-0.25*(\x)-4});
\draw[color=red,line width=1pt] (10,0) ellipse (0.5cm and 4.1cm); %grænse b
\draw[color=red,line width=1pt] (-3,0) ellipse (0.5cm and 1.6cm); %Grænse a
\draw (6,0) ellipse (0.5cm and 2.9cm);
\draw (2,0) ellipse (0.5cm and 2.9cm);
\draw (2,5.812) -- (6,5.812);
\draw (2,-5.812) -- (6,-5.812);
\draw[-,color=black,dashed, line width=1pt] (6,5.812) -- (6,0);
\end{tikzpicture}
\end{minipage}
\end{center}
\end{document}


\draw (0,0) to[out=10, in=190] (1,1);makes a curve going from (0,0) to (1,1). Leaving (0,0) at an angle of 10 deg and going into (1,1) at an angle of 200. You can read about different ways of making curves in TikZ includingtohere: https://tex.stackexchange.com/questions/33607/easy-curves-in-tikz – hpekristiansen Jul 03 '21 at 21:51