Using subs() on a vectorized function
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
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!
Risposte (1)
Walter Roberson
il 25 Feb 2016
1 voto
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.
Questa domanda è chiusa.
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!