replace expression of variables with an equivalent variable?
3 views (last 30 days)
Show older comments
Hi,
how can i get back theta_v instead of omega*t + phi_v?
% Code
clearvars; clc;
syms Vx positive
syms theta_v phi_v
syms omega t positive
theta_v = omega*t + phi_v;
v = Vx*sin(theta_v)
y = diff(v, t)
subs(y,omega*t + phi_v, theta_v)
0 Comments
Accepted Answer
Karan Gill
on 9 Dec 2016
Your substitution can't work because you defined "theta_v" to be "omega*t + phi_v". So you're just substituting "omega*t + phi_v" for the same thing. If you want to keep "theta_v" then don't define it as "omega*t + phi_v". Keep it as a symbolic function, and substitute in at the end.
>> syms x
>> syms theta_v(t)
>> syms Vx
>> v = Vx*sin(theta_v)
v(t) =
Vx*sin(theta_v(t))
>> y = diff(v, t)
y(t) =
Vx*cos(theta_v(t))*diff(theta_v(t), t)
>> syms omega phi_v
>> subs(y,theta_v, omega*t + phi_v)
ans(t) =
Vx*omega*cos(phi_v + omega*t)
0 Comments
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!