How to solve equation with "Error using symengine A square matrix is expected",
26 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello
My code below written to solve an equation works well with a single input parameter d (line 8). However, when I have a vector for the input "d" as shown in line 9, Matlab complain that I have "symengine". here is my code.Any help is appreciated.
clear all
clc
close all
% definition of constants
Y=9*10^(-13);
% d=20*10^-3;
d= linspace(1*10^-3,20*10^-3,10);
q=1.6*10^(-19);
kB=4.0434e-21;
er=2.8320e-11;
mp=1*10^-9;
mn=1*10^-9;
c=3.2520e+23;
kr=q*(mp+mn)/(er);
no=Y/(q*(mp+mn));
kdo=kr*no*no/c;
Lb= (q^2)/(8*pi*er*kB);
syms Vs
b=(Lb*q*(Vs./d))./(kB );
num=besselj(1,sqrt(-8*b));
den=sqrt(-2*b);
Fb=num./den;
kd=kdo*Fb;
eqn = (((kd*kr*c)^0.5).*d.^2)./(mp+mn)==Vs;
solVs = solve(eqn,Vs);
vpa(solVs)
0 commentaires
Réponse acceptée
Walter Roberson
le 8 Avr 2017
eqn = (((kd*kr*c).^0.5).*d.^2)./(mp+mn)==Vs;
Notice the .^ instead of ^
5 commentaires
Walter Roberson
le 8 Avr 2017
temp = arrayfun( @vpasolve, eqn, 'Uniform', 0);
solVs = horzcat( temp{:} );
Plus de réponses (0)
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!