필터 지우기
필터 지우기

Display numeric value before function with using syms

조회 수: 2 (최근 30일)
David Cole
David Cole 2024년 1월 2일
댓글: Dyuman Joshi 2024년 1월 12일
How can I force the numeric part of my function to display first?
syms t;
u=symunit;
current = vpa(0.002*sin(10^3*t));
displayFormula("i=current*u.A")

채택된 답변

Karl
Karl 2024년 1월 2일
You can include the unit when you define current:
syms t;
u=symunit;
current = vpa(0.002*sin(10^3*t))*u.A;
displayFormula("i=current")
  댓글 수: 1
Dyuman Joshi
Dyuman Joshi 2024년 1월 12일
I have accepted this answer, as it accurately provides the expected output.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Hassaan
Hassaan 2024년 1월 2일
편집: Hassaan 2024년 1월 2일
syms t;
u = symunit; % Define symbolic unit system
current = vpa(0.002*sin(10^3*t)); % Create a symbolic expression
% Append the unit
formattedCurrent = current*u.A;
% Display the formatted current with the unit
disp(formattedCurrent);
The variable current now holds a high-precision symbolic representation of the function 0.002*sin(1000*t). This expression has not been numerically evaluated because t is still a symbolic variable without a specific value.
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems
  • Electrical and Electronics Engineering

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by