How to explicit a matlab equation by using the symbolic toolbox?

조회 수: 18 (최근 30일)
Giuseppe
Giuseppe 2021년 6월 16일
답변: Paul 2021년 6월 16일
Hi guys, i want to obtain the expression of the velocity V of the following equation without solving the problem "by hand". I've the need to use the expression of V as a matlab function within a simulink project.
Is it possbile by using the symbolic toolbox? if yes, how?

채택된 답변

Paul
Paul 2021년 6월 16일
Looks like there are two solutions for V based on reasonable assumptions:
syms rho V CD0 K W S T positive
syms gamma real
eqn = T == sym(1/2)*rho*V^2*(CD0 + K*(W*cos(gamma)/(sym(1/2)*rho*V^2*S))^2)*S + W*sin(gamma);
sol = solve(eqn,V,'ReturnConditions',true)
sol = struct with fields:
V: [2×1 sym] parameters: [1×0 sym] conditions: [2×1 sym]
sol.V
ans = 
After you decide which solution is pertinent to your problem, you can generate from sol.V(1) or sol.V(2) a Matlab Function block (doc page) directly in your Simulink model.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by