Converting matrix multiplication into element-wise multiplication
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
adrien ameye
il 7 Apr 2021
Commentato: Star Strider
il 7 Apr 2021
Hi,
I'm using symbolic toolbox to solve non-linear differential equations.
It return an approximate solution with this formalism :
((Theta*w^2 - Theta*w0^2)^2 + (Theta^2*w^2*w0^2)/Q^2)^(1/2)
(Theta and w are two variables, and w0 and Q are two constants)
The aim is to replace Theta and w by grids :
Theta = linspace(0, 10, 1000);
w = linspace(0.1, 10, 501);
[w_grid, Theta_grid] = meshgrid(w, Theta);
((Theta_grid.*w_grid.^2 - Theta_grid.*w0.^2).^2 + (Theta_grid.^2.*w_grid.^2*w0^2)./Q^2).^(1/2)
It work perfectly, but i have to replace all the operators " * ", " / " and " ^ " by the operators " .* ", " ./ " and " .^ ", and then to change all the variables by the grids.
Is there a way to make this change automatically? For the moment, I have to do it manually.
0 Commenti
Risposta accettata
Star Strider
il 7 Apr 2021
I am not certain what you are doing, however it appears that using matlabFunction to convert the symbolic code to a form that can be used in numeric computations could do what you want.
2 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!