Question
I have to convert a program that i have in C++ to Mathlab. i have never worked with mathlab and have no idea how to
I have to convert a program that i have in C++ to Mathlab. i have never worked with mathlab and have no idea how to do it so if someone firmiliar with it can convert the code to work for me? the program is as followed:
#include
#include
using namespace std;
double deriv()
{
double y=0,e=2.71828,x;
double d=0.002;
cout<<"Original equation is y=(pow(e,(-2*x)))*sin(2*x)"< cout<<"Y' for every 0.2 of x is:"< for(x=0;x<=16;x+=0.2){ double yprime= (((pow(e,(-2*(x+d))))*sin(2*(x+d)))-((pow(e,(-2*x)))*sin(2*x)))/d; cout<<"x = "< } return y; } int main(){ cout<<"Therefore Y' = "< return 0; } the requirement of the program is basically to find the derivative of y=(e^-2x)sin(2x) using for-loop where 0<=x<=16, and delta x is 0.2. then the function must be called from main at the end. the result gives me the y' value of the derivative for every x value incrimented by .2 each time. thank you in advanced.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started