MATLAB VECTOR FIELDS j COMPONENT

조회 수: 3 (최근 30일)
Talha Yagli
Talha Yagli 2022년 12월 9일
댓글: VBBV 2022년 12월 9일
Hi everbody , I am trying to create a function tthat take a vector fforce field from user and seperate its i j k components.
ı am thinking to take the input as symfun and subs ,for example (i=1,j=0,k=0) for i component but as you can see matlab reads j as i (input was xi+yj+kz and the output of force_field variable xi+yi+zk) how can ı fix it ?

답변 (1개)

VBBV
VBBV 2022년 12월 9일
편집: VBBV 2022년 12월 9일
syms x y z i j k t r
f = dot([x y z],[i j k])
f = 
ff = symfun(f,[x y z i j k])
ff(x, y, z, i, j, k) = 
subs(ff,{x y z},{1 0 0})
ans(x, y, z, i, j, k) = 
i
  댓글 수: 3
Talha Yagli
Talha Yagli 2022년 12월 9일
편집: Talha Yagli 2022년 12월 9일
thank you , but how can ı get the f as an input form the user
VBBV
VBBV 2022년 12월 9일
When the user enters inputs in form of
[x y z i j k]
It is read into say X , then do
f = dot(X(1:3),X(4:6))

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by