Graph of Functions (MATLAB) PDF

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Summary

This document explains how to plot different functions in MATLAB, including 1/x^n, sine, cosine, and logarithmic functions. It shows examples of plotting these functions and the resulting graphs. The document provides code snippets in MATLAB syntax showing how to create each graph.

Full Transcript

The document describes how to plot several mathematical functions in Matlab. ```matlab x=linspace(-1,1); y=1./x.^3; plot (x,y) ``` This function creates a plot of $y = \frac{1}{x^3}$ for $x$ spanning from -1 to 1. The plot shows a vertical asymptote at $x=0$. ```matlab x=linspace(-1,1); y=1./x.^4;...

The document describes how to plot several mathematical functions in Matlab. ```matlab x=linspace(-1,1); y=1./x.^3; plot (x,y) ``` This function creates a plot of $y = \frac{1}{x^3}$ for $x$ spanning from -1 to 1. The plot shows a vertical asymptote at $x=0$. ```matlab x=linspace(-1,1); y=1./x.^4; plot(x,y) ``` This function create a plot of $y = \frac{1}{x^4}$ for $x$ spanning from -1 to 1. The plot shows a vertical asymptote at $x=0$ and is steeper than the previous plot. ```matlab x=linspace(-1,1); y=1./x.^5; plot(x,y) ``` This function creates a plot of $y = \frac{1}{x^5}$ for $x$ spanning from -1 to 1. The plot shows a vertical asymptote at $x=0$ and is steeper than the previous plots. ```matlab x=linspace(-1,1); y=sin(x); plot(x,y) ``` This function creates a plot of $y = sin(x)$ for $x$ spanning from -1 to 1. The plot shows a sinusoidal curve with a period of $2\pi$. ```matlab x=linspace(-10,10); y=x-exp(-x); plot(x,y) ``` This function creates a plot of $y = x-exp(-x)$ for $x$ spanning from -10 to 10. The plot shows a curve that approaches the line $y=x$ as $x$ increases. It also shows a horizontal asymptote at $y=-1$. ```matlab x=linspace(-1,1); y=x+sin(x); plot(x,y) ``` This function creates a plot of $y = x + sin(x)$ for $x$ spanning from -1 to 1. The plot shows a curve that is a combination of a straight line and a sinusoidal curve. ```matlab x=linspace(1,0); y=cos(x); plot(x,y) ``` This function creates a plot of $y = cos(x)$ for $x$ spanning from 1 to 0. The plot shows a curve that is a mirror image of the positive portion of the cosine curve. ```matlab x=linspace(-1,1); y=sin(1./x); plot(x,y) ``` This function creates a plot of $y = sin(\frac{1}{x})$ for $x$ spanning from -1 to 1. The plot shows a complex curve with an infinite number of oscillations as $x$ approaches 0. ```matlab x=0:1:10; y=log10(x); plot(x,y) ``` This function creates a plot of $y = log_{10}(x)$ for $x$ spanning from 0 to 10. The plot shows a logarithmic curve with a vertical asymptote at $x=0$.

Use Quizgecko on...
Browser
Browser