Karen Chen
Karen Chen

Reputation: 1

Matlab error incorrect number of inputs or outputs for function solve

I am trying to solve a simple equation in MatLab but I keep getting this error that says "Incorrect number or types of inputs or outputs for function 'solve'".

Here is my code:

syms tau12 sig11 sig22

tau12= 6e6
sig11 =22e6
sig22 = 10e6

solve(tan(2*theta) == tau12 / ((sig11 - sig22) / 2), theta)

atan, tand do not work. I think there might be something wrong because I see a matrix.

Upvotes: 0

Views: 11453

Answers (1)

Anthony Evans
Anthony Evans

Reputation: 31

I think the problem is that theta isn't a syms variable, so the first argument you're entering into solve isn't an object of class 'eqn'.

Try creating your equation as a separate variable first, like;

syms theta
my_eqn = tan(2*theta) == tau12 / ((sig11 - sig22) / 2)
solve(my_eqn, theta)

This should help you avoid similar issues in the future, by returning an error when you're creating the eqn object, rather than something more confusing when you're calling solve()

Upvotes: 1

Related Questions