1) Write a script that plots sin(x), cos(x), tan(x) for x between 0 and 360◦ (or 2π radians) on one graph, adjusts the y axis to range between −10 and +10, and includes a legend identifying each line.
2)Write a Matlab function that sums up a specified number of odd-power terms from the Maclaurin series of sin(x) For example, if you use the function you wrote to sum the first 10 terms for x = 1, you should get 1 − 1/3! + 1/5! − 1/7! + 1/9! − . . . − 1/19! = 0.8414709848078965
3)Explain what is displayed when you type the following Matlab commands in sequence: x = 0:2:9; y = [-1 5 7 8 4 3]; sum(x) * y(3)
Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
1)
clc;
close all
clear all
x=0:0.01:2*pi;
y1=sin(x);
y2=cos(x);
y3=tan(x);
plot(x,y1,'r',x,y2,'b',x,y3,'g');
ylim([-10 10]);
xlim([0,2*pi])
legend('sin(x)','cos(x)','tan(x)');
2)
clc;
close all
clear all
sum=0;
x=input('Enter x: ');
n=input('Enter number of terms: ');
count=1;
term=x;
for i=1:n
sum=sum+term;
term=-term*x*x/((count+1)*(count+2));
count=count+2;
end
disp(sum)
3)
x=0:2:9 will create a vector x with elements 0,2,4,6,8
y is a row vector
sum(x)=0+2+4+6+8=20
y(3)=7
So, sum(x)*y(3)=140
Kindly revert for any queries
Thanks.
1) Write a script that plots sin(x), cos(x), tan(x) for x between 0 and 360◦ (or...
Convince yourself that the Maclaurin Series for cos(x) is: A. Write a function script called cos_series that takes that takes as its inputs, x and N and has output given by the sum in the N-term Maclaurin Series approximation for Cos(x). Hint: try a “for loop” and set “format long” in your code. You may use the MATLAB built-in function factorial() B. Check your code by finding the 2-terms, 3-terms, 4-terms, 5-terms and 6-terms Maclaurin Series approximations every 30 degrees...
Find all solutions of the equation in the interval [0, 2π). tan"X-2 sec x =-1 write your answer in radians in terms of π. If there is more than one solution, separate them with commas. Find all solutions of the equation in the interval [0, 2π). 2sin-10 Write your answer in radians in terms of t If there is more than one solution, separate them with commas.
Matlab Problem No. 5 (14 pts) (3-Digits) er: f(x) = x^1.2 + sin(x) - tan(x) = x^2.1-333,333 Find the sum for the function f(x) for each odd integer: f(x) * Domain of x values are: (153,457 to 942,345) odd integers only
Problem 1 MATLAB A Taylor series is a series expansion of a function f()about a given point a. For one-dimensional real-valued functions, the general formula for a Taylor series is given as ia) (a) (z- a) (z- a)2 + £(a (r- a) + + -a + f(x)(a) (1) A special case of the Taylor series (known as the Maclaurin series) exists when a- 0. The Maclaurin series expansions for four commonly used functions in science and engineering are: sin(x) (-1)"...
4. Given (x)=x-5x + 5x5x2 - 6x , write a symbolic MATLAB script that: (a) plots g(x) in the interval -2 <x< 4, (b) finds and display all of its maxima and minima, (c) evaluates g(x) at the following values of x: -21, 21, 0, 1, 2st and displays the five results. tidad
A periodic signal, x(t) is shown below. A = 10, T-4 sec. -T Write a MATLAB script to plot the signal, using enough points to get a smooth curve. Compute the Fourier series coefficients for the signal (if you can find them in the text, that is ok). Plot the single-sided or double-sided spectra for each signal. Include enough frequencies in the plots to adequately represent the frequency content of the signals. Plot partial sums of the Fourier series for...
Task 2: (1 Mark) - Scripts Write a MATLAB script which plots the absolute error between your mySqrt() function and the built-in sqrt() function for a variety of N values with: N=1:20 • n=323158 err-le-3. Your plot should clearly show that error decreases until "saturating" somewhere below err. Because the algorithm "converges” (increased in accuracy) very quickly the true accuracy will be several orders of magnitude better than the err value. You should use semilogy () instead of plot() to...
Find the integral using matlab quad inbuilt for function (x^2)*cos(x)+3*sin(x)*tan(x) for 0 to pi/4
write matlab script 5. Use a for loop to sum the elements in x = [1 2 3 4 5] Check your answer with sum function 6. Use a while loop to sum the elements in x = [1 2 3 4 5] Check your answer with sum function
a.) Write a C++ program that calculates the value of the series sin x and cos x, sin 2x or cos 2x where the user enters the value of x (in degrees) and n the number of terms in the series. For example, if n= 5, the program should calculate the sum of 5 terms in the series for a given values of x. The program should use switch statements to determine the choice sin x AND cos x, sin...