Как записать экспоненту в матлабе
Перейти к содержимому

Как записать экспоненту в матлабе

  • автор:

02 Основы работы в MATLAB

Здесь exp( ) встроенная функция, вычисляет экспоненты.

eps − ε = 2.2204e-016 (самое малое число, которое отличает двух чисел друг от друга)

ans − результат последней операции без знака присвивания i, j − мнимая единица ( −1 )

inf − машинный символ бесконечности

NaN − неопределенный результат (0/0, ∞/ ∞, 1 ∞ , и т.д.)

Знак процента % используется при вводе комментарий в любом месте в листинге кода, в начале операции или между строками.

How to represent e^(-t^2) in MATLAB?

I am a beginner in MATLAB, and I need to represent e (-t 2 ) .

I know that, for example, to represent e x I use exp(x) , and I have tried the following

1) tp=t^2; / tp=t*t; x=exp(-tp);

What is the correct way to do it?

2 Answers 2

If t is a matrix, you need to use the element-wise multiplication or exponentiation. Note the dot.

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.

gives the results:

And using a scalar:

gives the results:

    The Overflow Blog
Related
Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.3.11.43304

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

MATLAB Exponential

By Priya PedamkarPriya Pedamkar

MATLAB Exponential

Introduction to MATLAB Exponential Function

MATLAB has a variety of commands & functions with numerous utilities. This article will focus on understanding a very important MATLAB function called the ‘exponential function’. We use exp(x) to calculate the exponential of a function passed as an argument. We will also understand how we can visually represent the exponential function. The function whose exponential we wish to calculate, is passed as an argument to the ‘exp’ command.

Python TutorialMachine LearningAWSArtificial Intelligence

TableauR ProgrammingPowerBIDeep Learning

Let’s first refresh our understanding of the exponential function.

Hadoop, Data Science, Statistics & others

Exponential function is a function where the constant is ‘e’ and it is raised to the power of an argument.

It can be represented as f(x) = b(x)

Here ‘b represents a real number which is positive

X represent an exponent argument

Exponential functions are functions of a real variable and the growth rate of these functions is directly proportional to the value of the function. The growth rate is actually the derivative of the function.

In the exponential function, the exponent is an independent variable.

Following is a simple example of the exponential function:

Exponential Function Example 1

As depicted in the above graph, the exponential function increases rapidly. Let’s take another function:

g(x) =1/2 raised to the power x, which is an example of exponential decay, the function decreases rapidly as x increases.

For f(x) in the previous example, the function doubles every time we add to x. In the exponential decay of the function, the function decreases to half every time we add to x. This is a feature of exponential functions, indicating how fast they grow or decay.

Example of MATLAB Exponential Function

Below are the examples of MATLAB Exponential:

Now we have brushed our understanding of exponential function, let’s understand its use in MATLAB.

Syntax:

y = exp (X) will return the exponential function ‘e’ raised to the power ‘x’ for every element in the array X.

It can also be used for complex elements of the form z = x + iy.

The output will be

e ^ z = e ^ x (sin y + i cos y)

Now we will understand the above syntax with the help of various examples

Types of Exponential Function in MATLAB

Below are the types of the exponential function in Matlab:

1. Exponential of unity

Let’s first compute the exponential of unity (1).

Code:

MATLAB Exponential Example 1

2. Exponential of Positive Number

Let us now take exponential of another positive number.

Code:

MATLAB Exponential Example 2

3. Exponential of Negative Numbers

The exponential of negative numbers is also possible. For our understanding let’s take the exponential of ‘-3’.

Code:

MATLAB Exponential Example 3

4. Exponential of Fractions

In the above examples, we saw how to take exponential of integers, we can also take exponential of fractions. For our understanding, let’s take fraction ¼ as an example.

Code:

MATLAB Exponential Example 4

5. Exponential of Floating Point Values

We can also calculate the exponential of floating point numbers. Let’s take a floating point value 2.23 for our understanding.

Code:

Floating Point Values Example 4

6. Exponential of Logarithmic Function

We can also calculate the exponential of a logarithmic function. Let’s take value ‘-2’ for our understanding.

Code:

Logarithmic Function Example 6

7. Plotting an Exponential Function

Let us now learn how can we plot an exponential function. A plot is visually more powerful than normal data when we want to analyze the behavior of our function.

Example:

Our function is A = e ^ (x / 3)

Let’s assume the values to be in the range [-3, 20]. This is how our input will look like:

Code:

X = -3 : 0.5 : 20;
A = exp (X / 3);
plot (X, A)

Output:

Plotting Example 7

So, in this article, we learned how to use the exponential function in MATLAB. We can use exp(x) syntax in MATLAB to calculate the exponential of any function which is passed as an argument. We can also plot the functions which we have computed using the ‘plot’ expression, which allows us to visually interpret our function.

Recommended Articles

This is a guide to MATLAB Exponential. Here we discuss the Introduction to MATLAB Exponential and its different Examples as well as its input and output. You can also go through our suggested articles to learn more –

Стандартные математические функции системы MATLAB

В системе MATLAB существуют стандартные (встроенные) элементарные функции вещественного аргумента.

Стандартные функции вещественного аргумента

отбрасывание дробной части числа

округление до меньшего целого

округление до большего целого

остаток от деления x на у без учета знака

остаток от деления x на у с учетом знака

разложение числа x на простые множители

Функции преобразования координат

преобразование декартовых координат в сферические

преобразование декартовых координат в полярные

преобразование полярных координат в декартовы

преобразование сферических координат в декартовы

функция Бесселя первого рода

функция Бесселя второго рода

модифицированная функция Бесселя первого рода

модифицированная функция Бесселя второго рода

неполная бета — функция

логарифм бета — функции

неполная гамма- функция

логарифм гамма- функции

Эллиптические функции и интегралы

эллиптическая функция Якоби

полный эллиптический интеграл

функция экспоненциального интеграла

дополнительная функция ошибок

масштабированная дополнительная функция ошибок

обратная функция ошибок

наибольший общий делитель

наименьшее общее кратное

обобщенная функция Лежандра

логарифм по основанию 2

возведение числа 2 в степень n

представление числа в виде рациональной дроби

формирование списка простых чисел

косинус гиперболический x

вычисляет число перестановок

вычисляет количество сочетаний из n по k

Далее представлены примеры применения функций.

Пример. Разложение чисел 5, 27, 46 на, простейшие множители.

Пример. Представление числа 1.25 в виде рациональной дроби.

Пример. Вычисление всех возможных комбинаций перестановок чисел 1,2,3.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *