Triplequad function with symbolic variables
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi Dear Matlab users
My problem is I wrote a function just below.
function out = ahmet(r,s,zeta)
syms z1
out=2*r.^2*s.^4*zeta*z1;
end
Then I called this function to be used for
k=triplequad('ahmet',-1,1,-1,1,-1,1)
It gives me errors telling that ''Inputs must be floats, namely single or double.''
If I omit z1 variable which is symbolic then it evaluates the quadrature but I want z1 stay and not calculated in the equation. Is it possible for quadrature ?
It is possible for int() command using symbolic variables. But I have to bring together both quadrature and symbolic variables ?
Thank you
0 commentaires
Réponses (1)
Walter Roberson
le 2 Mar 2013
syms r s zeta
k = int( int( int( ahmet(r, s, zeta), r, -1, 1), s, -1, 1), zeta, -1, 1);
Note that the result (if it can be analytically found) will likely have z1 as a free variable.
Caution: if you replace the limits of integration for zeta with "a" and "b", the integral works out as (4/15)*z1*(b^2-a^2) . And when abs(a) = abs(b) as is the case for -1 to +1, the solution is going to be identically 0 for all values of z1.
Voir également
Catégories
En savoir plus sur Number Theory dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!