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!

Answers (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.

This question is closed.

Products

Asked:

on 25 Feb 2016

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!