Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: dow define a numeric variable (no symbolic)?
Replies: 2   Last Post: May 9, 2013 8:32 AM

 Messages: [ Previous | Next ]
 Alan Weiss Posts: 1,430 Registered: 11/27/08
Re: dow define a numeric variable (no symbolic)?
Posted: May 9, 2013 8:32 AM

On 5/9/2013 7:21 AM, Nasser M. Abbasi wrote:
> On 5/9/2013 2:19 AM, ghasem wrote:
>>
>>
>> obviously,I get this error:
>> ??? Undefined function or variable 'bet'.
>> because I don't define bet in gam,T,tau expressions.
>> how define "bet" as a numeric unknown (I don't want use from "syms
>> bet")?
>>

>
> You can't.
>
> Matlab is not C nor C++ nor Pascal.
>
> In Matlab, you can only define and assign a value at
> same time, as in
>
> x=5;
>
> You can't just write
>
> x;
> or
>
> var x;
>
> Unless it is a sym, then you can define it as symbol
> with no value.
>
> But for numeric, it must be defined and given a value
> at same time.
>
> --Nasser

If you are trying to write a function of bet, you could write

function [X1,X2,X3] = mycalc(bet)
gam = sqrt(bet^^2 - k1^^2);
...

Alan Weiss
MATLAB mathematical toolbox documentation

Date Subject Author
5/9/13 ghasem
5/9/13 Nasser Abbasi
5/9/13 Alan Weiss