x=0:0.1:10;
y=exp(-x.^2);
plot(x,y) Answer from Azzi Abdelmalek on mathworks.com
How can I write E2 in MATLAB? is it expint?
How can I write E2 in MATLAB? is it expint? . Learn more about exponential integral, integral MATLAB More on mathworks.com
exponential - How to represent e^(-t^2) in MATLAB? - Stack Overflow
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... I am a beginner in MATLAB, and I need to represent e(-t2). More on stackoverflow.com
How do you put the constant e on matlab
How do you put the constant e on matlab. Learn more about constant, e More on mathworks.com
(e^(-2x))-2x+1
I want to plot the above equation in Matlab but i don't know how to plot. More on mathworks.com
Reddit
reddit.com › r/matlab › i need help. how do i write this function in matlab?
r/matlab on Reddit: I need help. How do I write this function in MatLab?
September 14, 2021 -
Does e stand for euler's number? But it still says that my y1 value is incorrect...
Top answer 1 of 2
1
you need to take a look at MATLAB syntax. Here is the equation you are trying to write: y = exp(0.5x)sin(2x) Here is what you actually wrote: y = exp(1)0.5x sin(2)x What you wrote was exponential to power of 1, times x halved, times sin of radians 2, times x. In MATLAB, to use the exponential function correctly you’d want exp(0.5.*x), same with the sin function: sin(2.*x) The command window is a great tool. Why not compare what exp(1) produces with exp(x)? Test everything to understand the syntax. Also use the documentation for any function. For example, for documentation of exp, type “help exp” or “doc exp”.
2 of 2
1
You might be technically right that exp(1) is just Euler's number, but that is absolutely not how that function is supposed to be used. I would preallocate a vector y1 the same length as x with zeros, and then loop over y1 and calculate each entry in that vector. That is, loop the expression y1(i)=exp(0.5*x(i))*sin(2*x(i)) for i=1:length(x). EDIT: I'm also curious about why you're using loglog. The scale of the axes don't require it at all. EDIT 2: I also tried it with y1=exp(1).^(0.5*x).*sin(2.*x) and that got the same answer as the looping solution I initial suggested. EDIT 3: Also, this equation has basically the form of a damped vibration, so the negative values would actually be of interest; thus using loglog() doesn't make any sense.
MathWorks
mathworks.com › matlabcentral › answers › 1665879-how-can-i-write-e2-in-matlab-is-it-expint
How can I write E2 in MATLAB? is it expint? - MATLAB Answers - MATLAB Central
March 7, 2022 - To calculate E2(x) in MATLAB, you can use “expint(2,x)” function.
MathWorks
mathworks.com › matlab › mathematics › elementary math › exponents and logarithms
exp - Exponential - MATLAB
This MATLAB function returns the exponential ex for each element in array X.
Top answer 1 of 2
14
If t is a matrix, you need to use the element-wise multiplication or exponentiation. Note the dot.
x = exp( -t.^2 )
or
x = exp( -t.*t )
2 of 2
5
All the 3 first ways are identical. You have make sure that if t is a matrix you add . before using multiplication or the power.
for matrix:
t= [1 2 3;2 3 4;3 4 5];
tp=t.*t;
x=exp(-(t.^2));
y=exp(-(t.*t));
z=exp(-(tp));
gives the results:
x =
0.3679 0.0183 0.0001
0.0183 0.0001 0.0000
0.0001 0.0000 0.0000
y =
0.3679 0.0183 0.0001
0.0183 0.0001 0.0000
0.0001 0.0000 0.0000
z=
0.3679 0.0183 0.0001
0.0183 0.0001 0.0000
0.0001 0.0000 0.0000
And using a scalar:
p=3;
pp=p^2;
x=exp(-(p^2));
y=exp(-(p*p));
z=exp(-pp);
gives the results:
x =
1.2341e-004
y =
1.2341e-004
z =
1.2341e-004
MathWorks
mathworks.com › matlab › mathematics › elementary math › exponents and logarithms
Powers and Exponentials - MATLAB & Simulink
This topic shows how to compute matrix powers and exponentials using a variety of methods.
MathWorks
mathworks.com › matlabcentral › answers › 493317-e-2x-2x-1
(e^(-2x))-2x+1 - MATLAB Answers - MATLAB Central
November 26, 2019 - (e^(-2x))-2x+1. Learn more about e
Narkive
programming.comp.narkive.com › EvMiAyFP › how-would-i-write-the-function-e-2x-in-matlab
How would I write the function e^2x in MatLab?
This Site Might Help You. RE: How would I write the function e^2x in MatLab?
MathWorks
mathworks.com › matlabcentral › answers › 651518-how-to-plot-f-y-e-x-sin-2x-function-in-matlab
How to plot f: y=e^-x.sin^2x function in matlab? - MATLAB Answers - MATLAB Central
November 17, 2020 - 2x is not valid matlab syntax. Use 2*x if x is a scalar or 2.*x if x is an array. Or, sin(x)^2 · Sign in to comment. Sign in to answer this question. Find more on Entering Commands in Help Center and File Exchange
MathWorks
mathworks.com › matlabcentral › answers › 516610-how-to-plot-f-x-y-e-x-2-y-2-function-in-matlab
How to plot "f(x,y) = e^-(x^2+y^2)" function in matlab? - MATLAB Answers - MATLAB Central
April 9, 2020 - How to plot "f(x,y) = e^-(x^2+y^2)"... Learn more about matlab function, matlab
EDUCBA
educba.com › home › data science › data science tutorials › matlab tutorial › exponential in matlab
Exponential in Matlab | How to do Exponential in Matlab?
March 13, 2023 - Then we write the exponential equation using exp function, we take an exp in parenthesis x1 is multiply by 2 and these exponential values are assigned to variable y1, the equation is y1 = e^x, the value of x1 is varied from -5 to 20 and according ...
Call +917738666252
Address Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
MathWorks
mathworks.com › matlabcentral › answers › 328438-writing-an-exponential-equation-in-the-title
Writing an exponential equation in the title - MATLAB Answers - MATLAB Central
March 6, 2017 - I would like to write my exponential equation in the title of my figure. Right now I have: title(['y = ',num2str(a),' x^', (num2str(n))]); The problem is my equation comes out as: y = ...
MathWorks
mathworks.com › matlabcentral › answers › 241775-how-can-i-plot-y-e-2x-sin2x-and-its-derivative-on-the-same-graph-using-two-different-colors
how can I plot y = e^(-2x)Sin2x and its derivative on the same graph using two different colors? - MATLAB Answers - MATLAB Central
September 9, 2015 - https://www.mathworks.com/matlabcentral/answers/241775-how-can-i-plot-y-e-2x-sin2x-and-its-derivative-on-the-same-graph-using-two-different-colors#answer_191831 ... The easiest solution is to use the gradient function rather than diff.
MathWorks
mathworks.com › matlabcentral › answers › 68299-how-to-write-e-in-matlab
How to write e in matlab - MATLAB Answers - MATLAB Central
March 22, 2013 - I couldn't figure out from your question whether you wanted the value e = exp(1) = 2.71828182845905, or whether you wanted to know how to raise e to some expression, like exp(-2*t/T) but you already seemed to know how to do that.