is there any way to change from * to .* in a expression automatically?

Hello, suppose I have found an expression like:
syms q1; syms Dq1
H2 = 3*Dq1^2*sin(q1);
where I would find after:
q1 = [0.09 0 0.1675]; %coefficients of a polinomial
Dq1 = [0.18 0]; %coefficients of the derivative of q1
t = linspace(0,1,100);
q1 = polyval(q1,t);
Dq1 = polyval(Dq1,t);
I want to plot H2 in function of t. Instead of using '*' in the expression of H2, I had to use '.*' to be able to multiply the vectors element by element. (and '.^2' either). But I did that manually since H2 is a small expression.
My question is: would there be a way that would do that automatically? Because H2 in my code is pretty huge, it would be impossible to change it manually. Would there be another way to evaluate the symbolic terms and do the element by element operations so I could be able to plot it?
Thanks!

 Accepted Answer

More Answers (0)

Categories

Asked:

on 20 May 2014

Edited:

on 20 May 2014

Community Treasure Hunt

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

Start Hunting!