fuction [detofA,x]=solveAxB(t) error why
Show older comments
fuction [detofA,x]=solveAxB(t)
%SOLVEAxB: solve the linear system Ax=B
%this function solveAxB.m
%to call this function type:
%[detofA,x]=solveAxB(t)
%where t is the input parameter and
%detofA andare out puts detrmined of A
%and the unknown X
A=[5,2*t,t;3,6,2*t-1;2,t-1,3*t];
% above line creates coeff matrix A
B=[2,3,5]'; %this creates column vector B
detofA=det(A);%find the dermint of A
X=A\B; %find x
2 Comments
Walter Roberson
on 12 Mar 2016
What is the error message? What parameter are you passing to it?
muhammad luqman
on 14 Mar 2016
Answers (1)
Geoff Hayes
on 14 Mar 2016
muhammad - the problem is with the function signature
fuction [detofA,x]=solveAxB(t)
You have written fuction instead of function. Change the above to
function [detofA,x]=solveAxB(t)
and ensure that the file is saved as solveAxB.m. Note that when you call this function, it will be from the Command Window (or from within another script) doing something like
t = 42;
[detOfA,x] = solveAxB(t);
Since this function requires an input parameter you must supply it with one (in this case, 42). If you were to try and run this function (from the editor) you will get an error like
Error using solveAxB (line 9)
Not enough input arguments.
1 Comment
muhammad luqman
on 15 Mar 2016
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!