Question

Matlab equation solve code please show me the code for how to solve x=1-e^-2x in Matlab...

Matlab equation solve code

please show me the code for how to solve x=1-e^-2x in Matlab with explanation

show me the code and result

Homework Answers

Answer #1

clc;
close all;
clear all;
syms x;
f=@(x) x+exp(-2*x)-1; %Enter the Function here
g=@(x) 1-2*exp(-2*x)+5; %The Derivative of the Function
n=7;
epsilon = 1*10^-(n+1);
x0 = 1;
for i=1:100
f0=vpa(subs(f,x,x0));
f0_der=vpa(subs(g,x,x0));
y=x0-f0/f0_der; % The Formula
err=abs(y-x0);
if err<epsilon %checking the amount of error at each iteration
break
end
x0=y;
end
y = y - rem(y,10^-n) %Displaying upto required decimal places

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
solve the given DE equation y''-4y'+20y= (x+1)e^2x cos x + 2x^2 e^2x sinx
solve the given DE equation y''-4y'+20y= (x+1)e^2x cos x + 2x^2 e^2x sinx
What is the python code to solve this type of equation in jupitor notebook 11.1cos(x)+44.9sin(x)-1.827=0 Please...
What is the python code to solve this type of equation in jupitor notebook 11.1cos(x)+44.9sin(x)-1.827=0 Please show the code clearly.
Show that there is a solution to the equation e^x=3-2x in the interval(0,1)
Show that there is a solution to the equation e^x=3-2x in the interval(0,1)
PLEASE PLEASE SHOW YOUR WORK 1a. Solve the equation: y = 3x2 -2x - 5 1b....
PLEASE PLEASE SHOW YOUR WORK 1a. Solve the equation: y = 3x2 -2x - 5 1b. Now use f(x) = x3 + 2x2 -5x - 6 to list all of the potential rational zeros of this function AND find the real zeros of f algebraically (show synthetic division at least once) and use the to factor f.
4) Solve the following differential equation dy dx = y x + x pls show me...
4) Solve the following differential equation dy dx = y x + x pls show me the steps
solve using Laplace x''-2x' + 2x = e^2t    x(0) = 1; x'(0) = 0
solve using Laplace x''-2x' + 2x = e^2t    x(0) = 1; x'(0) = 0
Please solve this using the superposition approach y''+4y'+5y=e^(-2x)cos x
Please solve this using the superposition approach y''+4y'+5y=e^(-2x)cos x
Solve the equation and please show your work 3(x+1)+2(x+4)=5x+6
Solve the equation and please show your work 3(x+1)+2(x+4)=5x+6
Q8)Problem Kong1: Solve for the general solution of the equation: 2x’’+ 200x = 0. Show all...
Q8)Problem Kong1: Solve for the general solution of the equation: 2x’’+ 200x = 0. Show all math steps. Q9)Problem Kong2: Solve for the particular solution of Kong1 if x(0)=1 and x’(0)=20. Show all math steps. Q10)Problem Kong3:    Solve for the general solution of the equation: 2y’’ + 4y’ + 200y = 0. Show all math steps.
x’+2x=sin(t), x(0)=1 solve the first order differential equation.
x’+2x=sin(t), x(0)=1 solve the first order differential equation.