Question

In: Computer Science

Using Matlab, Write a script that validates the relationship between sin u, cos u, and tan...

Using Matlab, Write a script that validates the relationship between sin u, cos u, and tan u by evaluating these functions at suitably chosen values. Please screenshot Matlab screen. Thank you!

Solutions

Expert Solution


clear;
clc;

% according to trignometric angles formula,
% tan(ϑ) = sin(ϑ)/cos(ϑ)
% to check whether both have accuracy,
% we can know presicion of angles we have to 
% find the difference
% sin(ϑ)/cos(ϑ) - tan(ϑ)
% majority of values have high presicion.
% values are approximate untill e^-16
angle = 0;
presicion = sin(angle)./cos(angle) - tan(angle)
angle = pi./2;
presicion = sin(angle)./cos(angle) - tan(angle)
angle = pi;
presicion = sin(angle)./cos(angle) - tan(angle)
angle = 3*pi./2;
presicion = sin(angle)./cos(angle) - tan(angle)
angle = 2*pi;
presicion = sin(angle)./cos(angle) - tan(angle)



angle = 2.*pi./3;
presicion = sin(angle)./cos(angle) - tan(angle)
angle = 5.*pi./3;
presicion = sin(angle)./cos(angle) - tan(angle)

Code

Output


Related Solutions

Given the parametrized curve r(u) = a cos u(1 − cos u)ˆi + a sin u(1...
Given the parametrized curve r(u) = a cos u(1 − cos u)ˆi + a sin u(1 − cos u)ˆj, u ∈ [0, 2π [ , (with a being a constant) i) Sketch the curve (e.g. by constructing a table of values or some other method) ii) Find the tangent vector r 0 (u). What is the tangent vector at u = 0? And at u = 2π? Explain your result. iii) Is the curve regularly parametrized? Motivate your answer using...
Write a matlab code for given task Use your ‘sin’ or ‘cos’ function to generate a...
Write a matlab code for given task Use your ‘sin’ or ‘cos’ function to generate a sinusoid wave having two components as f1 = 3kHz and f2 = 5kHz and then sample it with fs = 10kHz. Calculate its fft with zero frequency component in the middle. Plot it on a properly scaled w-axis. Specify if there is aliasing or not? If there is aliasing specify which component is casing the aliasing
If u(t) = < sin(8t), cos(4t), t > and v(t) = < t, cos(4t), sin(8t) >,...
If u(t) = < sin(8t), cos(4t), t > and v(t) = < t, cos(4t), sin(8t) >, use the formula below to find the given derivative. d/(dt)[u(t)* v(t)] = u'(t)* v(t) + u(t)*  v'(t) d/(dt)[u(t) x v(t)] = <.______ , _________ , _______>
If u(t) = < sin(5t), cos(5t), t > and v(t) = < t, cos(5t), sin(5t) >,...
If u(t) = < sin(5t), cos(5t), t > and v(t) = < t, cos(5t), sin(5t) >, use the formula below to find the given derivative. d/dt[ u(t) * v(t)] = u'(t) * v(t) + u(t)* v'(t) d/dt [ u(t) x v(t)] = ?
Write as a MatLab script For X=-2π~2π with intervals of π/100. a. Plot Y1=sin(X) as a...
Write as a MatLab script For X=-2π~2π with intervals of π/100. a. Plot Y1=sin(X) as a red line. Add a grid. b. Plot Y2=cos(X) as a black dotted line. Add a grid. c. Plot Y1 and Y2 in the same plot without using the hold on/off command. d. For Y3= Y1 times Y2, plot Y1, Y2 and Y3 in the same graph. Y3 will be green line. Add title, axis label and a legend.
Using MATLAB or Octave, Write a script that prompts the user for the coordinates of three...
Using MATLAB or Octave, Write a script that prompts the user for the coordinates of three points A, B, and C, namely (xA, yA), (xB, yB), (xC, yC), forming a triangle, storing each in a variable (for a total of 6 variables). The script should then calculate the centroid G = (xG, yG) using xG = xA+xB+xC 3 and yG = yA+yB+yC 3 , storing each in a variable. Finally, the script should print all four points. Sample output: Enter...
MATLAB: Write as a script in the editor window of matlab. Quadratic roots. Write a program,...
MATLAB: Write as a script in the editor window of matlab. Quadratic roots. Write a program, quadroots.m, for finding the roots of the second- order polynomial ax2 + bx + c. Use the quadratic equation. The inputs are the coefficients a,b, and c and the outputs are z1 and z2. The program should produce (exactly) the following output in the Command window when run with (a, b, c) = (1, 2, −3):
using matlab Write a script that simulates a card game that works as follows: A dealer...
using matlab Write a script that simulates a card game that works as follows: A dealer places 5 cards face down on the table and flips the first card. The player goes down the line, one at a time, and guesses if the next card is higher or lower than the card displayed, and then the next card is revealed. In the end, the player is awarded a point for each correct guess. In terms of coding, your script should...
Using MATLAB or Octave, use documenting code to Write a script that prompts the user for...
Using MATLAB or Octave, use documenting code to Write a script that prompts the user for a minimum and maximum real number, then generates and prints a random number in the requested range. The script should then do the same for an integer range. Sample output: Enter a minimum real value: 0.5 Enter a maximum real value: 30 A random number in the range ( 0.5000, 30.0000 ) is 1.7851 Enter a minimum integer value: -10 Enter a maximum integer...
Write a MATLAB script file that will give the value of f(x) using method of least...
Write a MATLAB script file that will give the value of f(x) using method of least squares and asks the user to enter values of x, y, n (curve fit), and x for f(x).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT