Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Strange problem with an equation

Asked by Christian on 7 May 2013

So I'm working on this school project where we have to calculate T from an equation using fsolve. But Matlab won't use my equation, because T isn't estimated yet.

So when i run the script:

JacobFormula = ((Q)/(4*pi*T))*(log((2.25*T*t)/((r^2)*S)))-s;

The output is:

Undefined function or variable 'T'.

Which results that i can't go futher to find T. (All the other values are known)

0 Comments

Christian

Tags

Products

No products are associated with this question.

1 Answer

Answer by the cyclist on 7 May 2013

First, the way you have defined JacobFormula, it is a variable and not a function. Here is a simple example of defining a function:

>> F = @(T) 3*T;

Then you can see that

 >> F(8)
ans =
    24

You will be able to use that function F as an argument to fsolve.

2 Comments

Christian on 7 May 2013

Oh thank you, that got me a little futher :-) But now it comes up with this:

Error using ^ Inputs must be a scalar and a square matrix. To compute elementwise POWER, use POWER (.^) instead.

Error in @(T)((Q)/(4*pi*T))*(log((2.25*T*t)/((r^2)*S)))-s

the cyclist on 7 May 2013

Can you post your full code, or at the very least a self-contained portion that can be run from scratch?

the cyclist

Contact us