MATLAB Script (Run it as a script, not from command window):
close all
clear
clc
x = linspace(0,4,100);
y = zeros(size(x));
for i = 1:length(x)
y(i) = lambertW(x(i));
end
plot(x,y), xlabel('x'), ylabel('y = W(x)')
title('Lambert Function')
function y = lambertW(x)
func = @(y) x - y*exp(y);
y0 = 0;
y = fzero(func, y0);
end
Plot:
in matlab 4.1.6 Lambert's W function is defined as the inverse of xe. That is, y-W(x)if and only if x = ye, Write a function y=1ambertW(x) that computes W using fzero. Make a plot of W(x) for...
(a) The MATLAB command trapz(x,y) computes the integral of the function y with respect to the 'variable of integration' r, i.e J ydr. Use MATLAB help to understand how trapz works. (b) Consider r(t) 1 for -1 t1, and r(t) 0 otherwise. Use the trapz command to compute and plot the Fourier transform of r (t). Denote this by X (jw). compute and plot the inverse Fourier transform of 2πX(jw). in part b)? Why, or why not? This is called...
In MATLAB please Consider the nonlinear function: y = f(x) = x3 cos x a. Plot y as a function of x as x is varied between -67 and 67. In this plot mark all the locations of x where y = 0. Make sure to get all the roots in this range. You may need to zoom in to some areas of the plot. These locations are some of the roots of the above equation. b. Use the fzero...
Please solve using MATLAB. Write a MATLAB function to compute and plot the output of the discrete-time system for x[n]-u[n], 0 < n < 1000. Based on these results can you make a statement regarding the stability of the system? Hint: Check the value y[600]
Question 1: Creating a user-defined function Write a user-defined MATLAB function named PBTask4pl_f.m for the following math function with x the input argument and y the output y(x)=0.8x4-13x2-5x The function should work for x being a scalar or a vector. Write a script file named PBTask4pl.m to a) Use the function to calculate y(3) and y(5) and display the results in command window b) Use the function to make a plot of the function y(x) for -5:5: x 5:5. Label...
Numerical Analysis: Make a matlab code that computes the Midpoint rule/method for a given function f'(t,y) = y' = t + y from 0 < t < 4 (inclusive) with h=0.5 and with initial condition y(0) = 0. Please make output display in tabular form and not in a plot, that doesn't help show the actual values.
Write a user-defined MATLAB function for the following math function y(x). The input to the function is x and the output is y. y(x)=-(0.2*x^4)+((e^-0.5*x)*x^3)+7*x^2 Call the function to calculate y(x) over the interval -3 ≤ x ≤ 4 for each increment of 1. Display x and corresponding y(x) in a text file with labeled column headings. Use the type command to display the contents in the text file.
Numerical Analysis: Make a matlab code that computes the Modified Euler's method for a given function y' = t + y from 0 < t < 4 (inclusive) with h=0.5 and with initial condition y(0) = 0. Please make output display in tabular form and not in a plot, that doesn't help show the actual values.
matlab only Question 5: a.) Write an m-file using conditional statements to evaluate the following function, assuming that the scalar variable x has a value. The function is for x <-1 - 3e y=2+cos(m) for-1 x<5 y 10-5)+1 for r 2 5 Use your file to evaluate y for x5, x-3, and x-15, and Use keyboard entry for values of x. b.) Use a for loop in the above file to plot the above function over the interval -2x <10....
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...
Create a surface plot and a contour plot of the function z=(x-2)^2+2xy+y^2. Using the matlab