Use Mathlab to build following:
MATLAB Code:
close all
clear
clc
format long
f = @(x) exp(-0.5*x)*cos(5*x) - 0.5;
x0 = 0; x1 = 1;
delta_f = 1e-16;
root = Bisection1(f,x0,x1,delta_f)
function c = Bisection1(fun,x0,x1,delta_f)
% fun = function.
% 'x0' and 'x1' are endpoints of the interval, where fun(x0) and
fun(x1)
% must have opposite signs.
% delta_f = tolerance
c = (x0 + x1)/2;
while abs(fun(c)) > delta_f
c = (x0 + x1)/2; % Midpoint
% Get new endpoint
if sign(fun(c)) == sign(fun(x0))
x0 = c;
else
x1 = c;
end
end
end
Output:
root =
0.197248856545516
Use Mathlab to determine the solution of the following differential equation satisfying the given initial conditions. (d^2y/dx^2)-4y=5 y(0)=0, y'(0)=1
Use MATHLAB to answer the following question. Post your full working code and a screenshot of the output! 1. Write a function sumsteps2 that calculates and returns the sum of 1 to n in steps of 2, where n is an argument passed to the function. For example, if 11 is passed, I will return 1+3+5+ 7 + 9 + 11. Do this using a for loop. Calling the function will look like this: >> sumsteps 2(11) ans = 36...
7 please answer fast and please use mathlab and include a copy code.. im using r2016b. Thanks
Use a Mathlab program using the while/for command and run it for the following exercise. 20. A twin primes is a pair of prime numbers such that the difference between them is2 (for example, 17 and 19). Write a computer program that finds all the twin primes between 10 and 500. The program displays the results in a two- column matrix in which each row is a twin prime. Do not use MATLAB's built-in function is prime. Use a Mathlab...
if you use mathlab just show the process pleace its okay if you do it without mathlab , just show the process 2. The equations of motion of this system are; 12Y"+7Y'+247-62-122=0 62"' +62 +12Z- 6Y-12Y=f(t) 7W"+7W'+14W-7Y+-14Y=ft) Where Y, Z and W are deformations of the masses and springs. Put these equations into state variable form and express the model as matrix vector equation if output of the system is Y. Energy Storage Element mi m2 m3 ki k2 k3...
solve the following problems using mathlab, step by step Provide the script file to determine the sum of series y with the following definition at range -5 sxs 30 (increment resolution of 0.5) y = 15*sqrt(4*x) +10, X29 10*x+10, 0 <x<9 10, x<0
Create a mathlab code. Create MATLAB/Scilab code that calculates an average and a standard deviation of 8 numbers. Use 2,0,3,0,6,9,4,0 as eight 1 digit numbers to be used for your calculation. Use the following formula for calculating the standard deviation. Use MATLAB function "std"/Scilab function "stdev" to calculate the standard deviation. Compare your result with the result produced by the function. Hypothesize the reason why they are different. (If you do not see a pattern, try different set of numbers...
mathlab Q2. Write a script file that accepts the user input of array of any size then uses nested for loops to find the minimum and maximum elements in the array. See slides 43,44 & 45 for hints Use the following 2 arrays to test your script: A- A 10 10 -4 17 2 5 0 13 -7 9 AND لیا M -1 5 -7 4 7 17 6 9 10 Sample Outputs: For the given array, the min. value...
program using mathlab 5. Calculation of Series Calculate the summation of the following series for proving if the series are convergent. 1 1 1 1 1 1 f = 7+3+6 + 10 + 15 + 21+ 1 1 1 1 1 1 g=i+2++3+16 +39 +... ES = 2 Make a program to calculate above series. Your m-file must use "for' or 'while. Make the following dat files and submit them. - save f with 10 time iterations on HW2_12.dat file...
(10pts)Use the subset construction to build a DFA that recognizes the language recognized by the following NFA. Clearly show your steps so that it is clear that you used the subset construction. 2 90