What is the Graph of $f(x)=3\cos(\pi x-2)+5$ with Amplitude and Period?

  • MHB
  • Thread starter karush
  • Start date
In summary, the code includes a variable called $\pi x-2$, which is used to calculate the cosine of 90 degrees minus 2 radians.
  • #1
karush
Gold Member
MHB
3,269
5
$f(x)=3\cos(\pi x-2)+5$

ok I tried to find a tikz graph online but most were too involved
basically 2 periods
show only ticks for xy intersections and light dashed lines for Amplitude
no background grid just xy axis

ok founut d this it renders in overleaf but not here
also, transformation is not yet applied
\begin{tikzpicture}[help lines/.style={black!50,very thin}]
\draw[<->,thick] (-4.25,0)--(4.25,0) node
{$x$};
\draw[<->,thick] (0,-4.25)--(0,4.25) node[above] {$y$};
\draw[very thick,color=green] plot [domain={-360/90}:{360/90},smooth] (\x,{cos(90*\x)});
\end{tikzpicture}Mahalo​
 
Last edited:
Physics news on Phys.org
  • #2
\begin{tikzpicture}[help lines/.style={black!50,very thin}]
\draw[<->,thick] (-4.25,0)--(4.25,0) node {$x$};
\draw[<->,thick] (0,-4.25)--(0,4.25) node[above] {$y$};
\draw[very thick,color=green] plot [domain={-360/90}:{360/90},smooth] (\x,{cos(90*\x)});
\end{tikzpicture}

Seems to work for me here.

This is what you posted:
1642042750902.png
It's what we see when we switch to source mode, the wheel at the right top that looks like this:
1642042794813.png


Note the [RIGHT] and [/RIGHT] that are breaking up the TikZ code, and which aligns part of it to the right.
Can't have those. If we remove those markers, then the TikZ picture is rendered as it should.

It seems you accidentally aligned some of the text to the right, which happens if we select this option:
1642043079910.png
 
Last edited:
  • #3
\begin{tikzpicture}[help lines/.style={black!50,very thin}]
\draw[<->,thick] (-12,0)--(12,0) node {$x$};
\draw[<->,thick] (0,-1)--(0,6) node[above] {$y$};
\draw[very thick,color=black] plot [domain={-360/90}:{360/90},smooth] (3*\x,{cos(90*\x-2)+5});
\end{tikzpicture}

$f(x)=3\cos(\pi x-2)+5$
transform for 2 periods
ok just added A and B i think
but not PS or T
 
  • #4
\begin{tikzpicture}[xscale=.25,yscale=.5]
[help lines/.style={black!50,very thin}] \draw[<->,thick] (-12,0)--(12,0) node[below] {$x$};
\draw[<->,thick] (0,-1)--(0,6) node[above] {$f(x)$};
\draw[very thick,color=black] plot [domain={-360/90}:{360/90},smooth] (3*\x,{cos(90*\x-2)+5});
\end{tikzpicture}

Ok now I have to do the ticks for the min/max points of the graph
 
  • #5

karush

Well-known member

Jan 31, 2012 3,175
MHB TikZ Code
\begin{tikzpicture}[xscale=.25,yscale=.5] [help lines/.style={black!50,very thin}] \draw[<->,thick] (-16,0)--(16,0) node[below] {$x$};
\draw[<->,thick] (0,-1)--(0,6) node[above] {$f(x)$};
\node [below] at (-4*3.1416,0) {-4$\pi$};
\node [below] at (-2*3.1416,0) {-2$\pi$};
\node [below] at (2*3.1416,0) {2$\pi$};
\node [below] at (4*3.1416,0) {4$\pi$};
\draw[very thick,color=black] plot [domain={-360/90}:{360/90},smooth] (3*\x,{cos(180*\x-2)+5});
\end{tikzpicture}

ok still don't have this graph right...
 
Last edited:
  • #6
In the TikZ code, where do you get "cos(90*\x - 2)" from? If you want to change $\pi x-2$ from radians to degrees, I would expect to get 180*\x - 114.59, since 2 radians is (approx.) 114.59 degrees.
 
  • #7
\begin{tikzpicture}[xscale=1,yscale=.5]
[help lines/.style={black!50,very thin}]
\draw[-,thick] (-4,0)--(4,0) node[below] {$x$};
\draw[-,dashed] (-4,2)--(4,2) node[below] {$y=2$};
\draw[-,dashed] (-4,8)--(4,8) node at (5,8) {$y=8$};
\draw[-,dashed] (-4,5)--(4,5) node[below] {$y=5$};
\draw[->,thick] (0,-1)--(0,8) node[above] {$f(x)=3cos(\pi x-2)+5$};
\node [below] at (-3.1416,0) {-$\pi$};
\node [below] at (3.1416,0) {$\pi$};

\draw[very thick,color=black] plot [domain={-180/90}:{180/90},smooth]
(\x,{3*cos(180*\x-2)+5});
\end{tikzpicture}
 
Last edited:

1. What is the purpose of the "-tikz7.8.1" in the equation?

The "-tikz7.8.1" refers to the specific version of the TikZ package, a graphics package for LaTeX, that is being used to generate the graph. It allows for specific commands and features to be used in creating the graph.

2. What does the "y =" signify in the equation?

The "y =" indicates that the equation is describing a function with a dependent variable, y, and an independent variable, x. In this case, the function is being graphed on a two-dimensional coordinate plane.

3. What does "3cos(pi x-2)" represent in the equation?

The "3cos(pi x-2)" is the mathematical expression that describes the shape of the graph. It is a cosine function with an amplitude of 3, a period of 2pi, and a horizontal shift of 2 units to the right.

4. What is the significance of the "pi" in the equation?

The "pi" is a mathematical constant that represents the ratio of a circle's circumference to its diameter. In this equation, it is used to determine the period of the cosine function, which is 2pi.

5. What does the "+5" at the end of the equation indicate?

The "+5" is a constant that is added to the function. It represents a vertical shift of 5 units, meaning the entire graph will be shifted 5 units upwards on the y-axis.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
697
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Poll
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
969
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
958
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
740
Back
Top