SineEval
_______________
function y=SineEval(coefs,thta)
y=coefs(1)+coefs(2)*sin(1*thta)-coefs(3)*sin(2*thta)+coefs(4)*sin(3*thta)+coefs(5)*sin(4*thta)-coefs(6)*sin(5*thta);//expresssion
end
mainscript
______________________
step=20/200;%stepsize for 200 evenly space input
thtas=0:step:20-step;%input array theta
coefs=[-1,1.25,-2.5,0,5,-10];%co-efficent array for fun
for j=1 : 200%calling SineEval 200 times for succesive thetas
y(j)=SineEval(coefs,thtas(j));%storing the results in y(i)
end
figure
plot(thtas,y);
grid on;
xlable('theta(rads)');
ylable('x(m)');
title('-1+1.25sin(2theta)+5sin(4theta)-10sin(5theta)')
show
MATLAB HELP PLEASE Write a Matlab function that evaluates a sum of sines at a set...
MATLAB Only MATLAB Only MATLAB Only Indicated in the script below, write a function, called arbpoly3, that accepts two inputs: i) a row vector, called c, containing the coefficients of the polynomial, starting with the coefficient for the lowest degree term, which is the constant term. ii) a row vector, called x, which is the set of real numbers where the polynomial is to be evaluated. The output, y, will be a vector containing the values of the polynomial, evaluated...
PLEASE USE MATLAB
this problem you are trying to find an approximation to the periodic function /(t) esint-1) over one period, o <t < 2π. In t-linspace(0,2*pi,200)' and let b be a column vector of evaluations of f at those points. (a) Find the coefficients of the least squares fit In MATLAB, let (b) Find the coefficients of the least squares fit f(t)ndy+d2 cos(t)+ d, sin(t)+d, cos(2t)+dy sin(2t). (c) Plot the original function f(t)and the two approximations from (a) and...
i need Matlab code asap
Write a program that evaluates the function f(x) = tan’x + x - 2 between -27 and 27 in steps of 1/10 and plots the results. Create a function handle for your function, and use function feval to evaluate your function at the specified points. 2. Write a program that locates the zeros of the function f(x) = cos éx -0.25 between 0 and 27. Use the function fzero to actually locate the zeros of...
Questions a) Write a (Matlab) function, which accepts the following inputs: -the finite set of Fourier series coefficients a-N, a-N+1,.. , a-1, ao, a1, aN-1, aN the fundamental period T of the signal to be reconstructed a vector t representing the times for which the signal will be constructed - and produces as output xv(t) (i.e., the output of the (Matlab) function should be a vector x of length equal to the length of t containing the values of xN...
N MATLAB: This is an easy problem to demonstrate how polyfit and polyval work! The values in y are basically a sine function on x. You can validate by checking in MATLAB >> x = 0:9 x = 0 1 2 3 4 5 6 7 8 9 >> y = sin(x) y = 0 0.8415 0.9093 0.1411 -0.7568 -0.9589 -0.2794 0.6570 0.9894 0.4121 Now, let us try to see what happens if we use polyfit on the values of...
matlab please
Problem 3. / 30 points Let p(x) = C1 +222 + ... + -1. The value of p for a square matrix input is defined as p(X) - 17+ 2X + ... + CX- (a) (12 points) Show that if XeRkxk has an EVD, then p(x) can be found using only evaluations of p at the eigenvalues and two matrix multiplications. (b) (18 points) Complete the following program which, given coefficients c = (C1,C2,...,C.)", evaluates the corresponding polynomial...
Please use matlab
cars. Answer: Function file; Command Window: 5.4 Write a user-defined function that plots a circle given the coordinates of the center and the radius. For the function name and arguments use circleplot(x,y,R). The input arguments are the and y coordinates of the center and the radius. Use linspace to generte the angle from 0 to π with 100 points. (Hint: the circle equation: x+Rcos and yy-yRsin 0.) This function has no output arguments. Plot the circle using...
Problem 3: Write a MATLAB function called cubic_spline to compute the natural cubic spline for a given data set. The x and y data points and the rdesired values (a vector) should be the inputs, and the corresponding ydesired values (a vector) should be the output.
Need help with this MATLAB question
4.4 (25 points) Write and test the code for the function mysteryFunction that takes a vector, V, generate a new vector W, in which each element is the sum of the corresponding element in V and the previous element of V, and return two values (mysteryMean, mysteryStdev] of W. Consider the previous element of V(1) to be 0. For example, [mysteryMean, mysteryStdev] = mysteryFunction(1:8), W= [1 3 5 7 9 11 13 15] mysteryFunction...
write a MATLAB SCRIPT that will output A and B.
Problem 7.4 - Weight Supported by Two Cables PROBLEM DESCRIPTION This example is illustrated in the fure below. A weight W is supported by two cables anchored a distance D apart. The cable length Lan is given, but the length, Lac is to be determined. Each cable can support a maximum tension force equal to W. For the weight to remain stationary, the total horizontal force and total vertical force...