This is simple, but for some reason I can't find the solution anywhere on the internet. I have a vector function in MATLAB $$E(s)=(E_1(s),E_2(s),E_3(s))$$ I want to be able to index it, so normally in MATLAB you would use 'E(1)', for element one. However this just evaluates the vector at $s=2$. 'E(s)(1)' gives an error, this must be simple, it's ridiculous this is causing a problem.
Any help would be greatly appreciated, here's my code for reference
Actually you have a symbolic function that returns a vector. Type
whosand you'll see that the class ofEissymfun. Unfortunately, I don't think that you can directly index into a symbolic function. However, you can convert it into a symbolic expression (classsym) simply by setting it equal to another variable and passing in your symbolic variablesNow you should be able to evaluate
Es(1),Es(2), andEs(3)as you wanted.In the future, this sort of question would probably be better suited for Stackoverflow Matlab.