numerical values assignment to symbolic variables
조회 수: 3 (최근 30일)
이전 댓글 표시
채택된 답변
Sameer
2024년 9월 18일
Hi Ajinkya
To assign numerical values to "symbolic variables", you can use the "subs" function
Here's how you can do it:
syms V1 V2 V3 V4 V5 V6 V7 V8 V9
% Define the numerical values
values = [10, 20, 30, 40, 50, 60, 70, 80, 90];
% Substitute the values into the symbolic variables
V_values = subs([V1, V2, V3, V4, V5, V6, V7, V8, V9], [V1, V2, V3, V4, V5, V6, V7, V8, V9], values);
% Display the results
disp(V_values);
Direct Assignment in an Expression
If you are using these variables within an expression, you can substitute them directly:
syms V1 V2 V3 V4 V5 V6 V7 V8 V9
% Example expression
expression = V1 + V2 + V3;
% Substitute values
result = subs(expression, [V1, V2, V3], [10, 20, 30]);
% Display the result
disp(result);
Please refer to the below MathWorks documentation link:
Hope this helps!
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Variables, Expressions, Functions, and Preferences에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!