replace expression of variables with an equivalent variable?
조회 수: 3 (최근 30일)
이전 댓글 표시
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
채택된 답변
Karan Gill
2016년 12월 9일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!