I'm learning matlab and trying to implement small angle approximation using vectorisation. This is the formula I'm trying to implement:
I'm implementing this for 3 angles: pi / 100 , pi / 10 and pi / 6 . I've come up with this so far:
x = [pi / 100, pi / 10, pi / 6];
y = sin(x);
e = (y  x) ./ y;
This works fine. Now, I want to unpack the result into 3 variables. I know I can do this:
RelativeError100 = e(1);
RelativeError10 = e(2);
RelativeError6 = e(end);
But coming from a python background, this seems a bit clunky to me. So I tried this:
[RelativeError100, RelativeError10, RelativeError6] = e
Which errors out, giving Too many output arguments. . So, I did a little research, and came across this which suggests
[RelativeError100, RelativeError10, RelativeError6] = e{:}
Which throws a Cell contents reference from a noncell array object. .
What am I missing, and how can I get this to work? Or is it just not possible with matlab?
