Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Matlab. Not enough input arguments?

Status
Not open for further replies.

patrick.r

Newbie level 1
Joined
Mar 4, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
9
Code:
function y=draft(x)
C=25200;
B=-242.5;
R=3101.122;
y=(x^3)/C + (x^2)/B + x/R - 1;
x0=3101.122;
solution = fzero(draft,x0);

in line 5 that defines y, the error says that there are not enough input arguments. I've even tried a know code that should have worked but gave me the same error any insight would be helpful on how to fix it
 
Last edited by a moderator:

Once you are performing matricial division, I presume you should use the "./" operator instead the "/".
 

Once you are performing matricial division, I presume you should use the "./" operator instead the "/".

In his case i don't think his variables are matrices,they are scalars.But both('/' & './') should work,i guess.

@patrick.r
Your error - there are not enough input arguments.

I think you are not giving value of 'x' to your function. Try using the function,say as draft(100.25) in command window.It should work provided function is added to your path/in working directory.
 

Not only division operator, but also the power operator "^" must be in matrix format ".^":

Code:
y=(x.^3)./C + (x.^2)./B + x./R - 1
 

Code:
function y=draft(x)
C=25200;
B=-242.5;
R=3101.122;
y=(x^3)/C + (x^2)/B + x/R - 1;
x0=3101.122;
solution = fzero(draft,x0);

in line 5 that defines y, the error says that there are not enough input arguments. I've even tried a know code that should have worked but gave me the same error any insight would be helpful on how to fix it


Code:
function [ y ] = draft(x)
%UNTITLED2 Summary of this function goes here
%   Detailed explanation goes here

C=25200;
B=-242.5;
R=3101.122;
y=(x^3)/C + (x^2)/B + x/R - 1;
x0=3101.122;
function z = example(x0)
   z = fzero(draft,x0);
end
end
^ This will work along with my post 3.But i'm now trying on how to display the value of fzero function to command window as well.will reply back.

@andre_teprom:
Both('/' & './') & ('^'& '.^')should work.They are scalar variables
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top