How to convert the equation to MATLab code

165 vues (au cours des 30 derniers jours)
ayad filemban
ayad filemban le 10 Avr 2019
Help converting

Réponses (9)

Thomas Rosin
Thomas Rosin le 10 Avr 2019
Modifié(e) : Thomas Rosin le 10 Avr 2019

Walter Roberson
Walter Roberson le 19 Juil 2020
Modifié(e) : Walter Roberson le 19 Juil 2020
  1. MATLAB has no implied multiplication. All multiplication must be explicit with either the .* (corresponding elements, which is usually the desired operation) or * (inner product) operators
  2. e to a power is coded as exp() the power
  3. division is the ./ operator with the / operator being more like multiplying by the pseudo-inverse
  4. powers other than e to something, should be the .^ (element at a time) or ^ (matrix power through generalized inner product) operators.
  5. square root is usually most clear and efficient using sqrt() but .^0.5 or nthroot() can be used, and sometimes sqrtm() or ^0.5 are appropriate
For the kinds of equations that are shown here, use .* and ./ and .^ instead of * and / and ^

akram mehenni
akram mehenni le 2 Fév 2022
𝐸5 = 𝛼. 𝐸3 . √𝐸4
  1 commentaire
Walter Roberson
Walter Roberson le 2 Fév 2022
The equations that were posted have no E3, E4, or E5, so this does not appear to be an answer to the question that was put. How are people to understand this as a solution to the question ?

Connectez-vous pour commenter.


Marwa Hameed
Marwa Hameed le 12 Août 2022
Modifié(e) : Walter Roberson le 15 Août 2022
How can I convert
this equation to MATLAB ?
  1 commentaire
Walter Roberson
Walter Roberson le 15 Août 2022
Caution: you have variable names Q_min and Q_max but you are integrating with respect to log(Q) so Q_min and Q_max are limits on log(Q) not limits on Q.
Integrating with respect to a function instead of a variable is always tricky.
Pi = sym(pi);
syms a_0 E G_fi(Q) Q_max Q_min R sigma_Born T log_Q
eqn = sigma_Born == 4*Pi*a_0^2/(T/R) * int(G_fi(exp(log_Q))/(E/R), log_Q, Q_min, Q_max)
eqn = 

Connectez-vous pour commenter.


Vishwajeet
Vishwajeet le 29 Nov 2022
how can i convert Cu dTu/ dt = F αTu − γ (Tu − Td) to matlab code?
  1 commentaire
Steven Lord
Steven Lord le 29 Nov 2022
See the documentation for the ODE solvers. I'd start with ode45 and the pages listed under Topics at the end of that page.

Connectez-vous pour commenter.


HA
HA le 22 Juil 2023
Please, your support is needed, thank you
  4 commentaires
Walter Roberson
Walter Roberson le 23 Juil 2023
would be
kummerU(1/2, 5/4, tau_0.^4 ./ (32 .* log(2).^2 .* sigma_k2.^2))
This might require the Symbolic Mathematics Toolbox
HA
HA le 23 Juil 2023
Thank you

Connectez-vous pour commenter.


Om prakash Meena
Om prakash Meena le 13 Sep 2023

BUI
BUI le 5 Nov 2023
Help me convert this fuction please
  1 commentaire
Walter Roberson
Walter Roberson le 5 Nov 2023
"A function can be recovered from its Fourier series, under suitable conditions. When this is possible, the Fourier series provides the inversion formula: "
and look at the formula there. Now let lambda = -1/P ...

Connectez-vous pour commenter.


Essodokinam
Essodokinam le 31 Jan 2024
Hi everybody, I need you help for converting these function in matlab:

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by