- #1

- 3

- 0

function Ht=Height(t,V,Theta);

Ht=V*t*sin(Theta)-4.9*t.^2;

but then i kept on getting Input argument "V" is undefined...

can someone help me plz

- Thread starter qiyan31
- Start date

- #1

- 3

- 0

function Ht=Height(t,V,Theta);

Ht=V*t*sin(Theta)-4.9*t.^2;

but then i kept on getting Input argument "V" is undefined...

can someone help me plz

- #2

Mark44

Mentor

- 33,744

- 5,433

What you show above seems reasonable for the function definition. Show us how you are calling this function - that might be what's causing your error.

function Ht=Height(t,V,Theta);

Ht=V*t*sin(Theta)-4.9*t.^2;

but then i kept on getting Input argument "V" is undefined...

can someone help me plz

- #3

- 3

- 0

Here's the function.What you show above seems reasonable for the function definition. Show us how you are calling this function - that might be what's causing your error.

Ht=fminbnd(@Height,0,5000,V,Theta);

- #4

Mark44

Mentor

- 33,744

- 5,433

This doesn't make any sense to me. Use the function you wrote (the Height function) to calculate height, and then pass the value returned by that function as the first parameter in your fminbnd function.Here's the function.

Ht=fminbnd(@Height,0,5000,V,Theta);

- #5

- 78

- 0

If you go to matlab's command window type the function's name and then the values that you want to use. For example:

Height(3, 4, 60)

t = 3, V = 4, theta = 60

- #6

uart

Science Advisor

- 2,776

- 9

The function fminbnd() expects to be passed a function of a single variable.

- Last Post

- Replies
- 8

- Views
- 6K

- Last Post

- Replies
- 3

- Views
- 2K

- Replies
- 3

- Views
- 3K

- Replies
- 2

- Views
- 1K

- Replies
- 1

- Views
- 2K

- Last Post

- Replies
- 11

- Views
- 1K

- Replies
- 1

- Views
- 4K

- Last Post

- Replies
- 25

- Views
- 4K

- Last Post

- Replies
- 16

- Views
- 3K

- Replies
- 1

- Views
- 3K