Effacer les filtres
Effacer les filtres

replace expression of variables with an equivalent variable?

1 vue (au cours des 30 derniers jours)
MSleiman
MSleiman le 5 Déc 2016
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)

Réponse acceptée

Karan Gill
Karan Gill le 9 Déc 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)

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by