index notation symbolic toolbox

조회 수: 9 (최근 30일)
Dinant
Dinant 2013년 11월 4일
댓글: Steven Lord 2020년 2월 26일
example: fi = sym('fi',[1 2]) fi =
[ fi1, fi2]
I want this to be: fi =
[ fi(1), fi(2)]
This in order to use outcome of symbolic manipulation directly in my matlab code.
  댓글 수: 4
Sean de Wolski
Sean de Wolski 2014년 2월 20일
Dinant, I answered your question and provided you with code that does exactly what you asked for. If it's not, please clarify in your comments what you actually want.
Dinant Kistemaker
Dinant Kistemaker 2019년 2월 19일
Thanks for the help, but you did not. I have reinitiated my post in hope I can get a workaround for this...

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

답변 (6개)

Sean de Wolski
Sean de Wolski 2013년 11월 4일
>> fi = sym([1,2])
?

Dinant
Dinant 2013년 11월 4일
hmmm, what do you mean with the question mark?
  댓글 수: 7
Dinant
Dinant 2013년 11월 4일
I appreciate your help.
My question relates to the fact that directly want to use the output of symbolic manipulations in my matlab code that is vectorized. Symbolic output is not. It makes from fi(1) fi1. I do not want that. I want the output to be in terms of fi(1), fi(2), etc.
Sean de Wolski
Sean de Wolski 2013년 11월 4일
What release are you using? Because on mine(R2013b) it creates a 1x2 sym
Code:
fi = sym([1 2])
size(fi)
sin(fi(1))
Printed:
fi =
[ 1, 2]
ans =
1 2
ans =
sin(1)

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


Walter Roberson
Walter Roberson 2013년 11월 4일
syms fi
then fi(1) will be fi(1)
  댓글 수: 1
Dinant
Dinant 2013년 11월 4일
nope...
>> syms fi >> fi(1) ans = fi

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


Dinant Kistemaker
Dinant Kistemaker 2019년 2월 19일
I am still very much looking forward to an answer to my question. It is really annyoing that the printed format is not in vector notation. I want to use the output for some symbolic manipulations in my code and I want to use vector notation.
if I type:
fi = sym ('fi',[1 3]);
x=cos(fi)
>>x =
[ cos(fi1), cos(fi2), cos(fi3)]
I would very much want to have the answer in vector notation like:
x =
[ cos(fi(1)), cos(fi(2)), cos(fi(3))]

Dinant Kistemaker
Dinant Kistemaker 2019년 2월 26일
Nobody???

Dinant Kistemaker
Dinant Kistemaker 2020년 2월 26일
I am so looking forward to an answer to my problem...
Somebody from the Mathworks?
  댓글 수: 1
Steven Lord
Steven Lord 2020년 2월 26일
If you want an official MathWorks answer please contact Technical Support directly using the telephone icon in the upper-right corner of this page.
I suspect you will not be able to do what you want with sym or syms. Depending on what "use outcome of symbolic manipulation directly in my matlab[sic] code" means the matlabFunction function may be of use.

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

Community Treasure Hunt

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

Start Hunting!

Translated by