Using subs() on a vectorized function
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
Hi,
I am attempting to substitute a number for a symbolic variable in a vectorized equation, but I receive the following error:
Error using sym>convertExpression (line 1379) Conversion to 'sym' returned the MuPAD error: Error: Invalid input. 'expression' is expected.
My code is as follows, I've played around with it and the vectorization seems to be the problem.
S= 755*h^3*(24*cot(a)*(h/(h + 1/10000) - 1))
Sv=vectorize(S)
for ad=[10:2.5:30,35:5:70]
hin=(.000025:.00001:.0002);
S_sub=subs(Sv,[a, h],[ad,hin])
end
I could do an embedded for loop for hin and ad and forget the vectorization, but I'd rather not (I'm not as familiar with building matrices from for loop outputs).
Thank you!
0 个评论
回答(1 个)
Walter Roberson
2016-2-25
1 个投票
vectorize() is not defined for symbolic expressions. I do not know what the result would be. Maybe empty, maybe a string.
You do not need to vectorize a symbolic expression: when you use matlabFunction() the result will automatically be in vectorized form.
0 个评论
此问题已关闭。
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!