MATLAB matrix using in function
11 次查看(过去 30 天)
显示 更早的评论
I can't use matrix in my functions. Can you help me?
u=symunit;
M=7.75*u.cm
R=2.54*u.m
a_ef=10:10:100
deltap=-7.55*(M^2/R^2)*(1/(0.116+log(R/2.405*a_ef)))
Error using symengine
Invalid operands.
Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:});
X = privBinaryOp(A, B, 'symobj::mrdivide');
0 个评论
回答(2 个)
Steven Lord
2020-11-16
Use element-wise division for the operations that will operate on the vector a_ef.
deltap=-7.55*(M^2/R^2)*(1./(0.116+log(R./2.405*a_ef)));
The first division, M^2/R^2, is dividing two scalars so ./ is not required (but it would work.)
2 个评论
Steven Lord
2020-11-16
编辑:Steven Lord
2020-11-16
You did not replace / with ./ in the last line. When I do I can run it. If this resolves the problem please delete your flag and accept the answer. Thanks.
u=symunit;
M=7.75*u.cm;
R=2.54*u.m;
a_ef=(10:10:100)*u.mm;
deltap=-7.55*((M^2)/(R^2))*(1./(0.116+log((R)./2.405*a_ef)));
deltap(1)
simplify(deltap(1))
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multirate Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

