Do you know how can I fix this error? "Not enough input arguments" Thanks
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
0 votes
function r = rank(A,tol)
%RANK Matrix rank.
% RANK(A) provides an estimate of the number of linearly
% independent rows or columns of a matrix A.
% RANK(A,tol) is the number of singular values of A
% that are larger than tol.
% RANK(A) uses the default tol = max(size(A)) * eps(norm(A)).
s = svd(A);
if nargin==1
tol = max(size(A)) * eps(max(s));
end
r = sum(s > tol);
>>>Error using rank (line ) Not enough input arguments<<>> s = svd(A); <<<
My matrix is A=[1 4 3 7 ; 2 6 8 3 ; 1 3 4 5 ; 4 13 15 15] And I am trying to calculate rank of A.
Accepted Answer
Star Strider
on 1 May 2015
0 votes
How are you calling it?
Are you including a value for ‘tol’ as your function requires?
10 Comments
Keti Kapa
on 1 May 2015
I am saving it as "rank" . http://dali.feld.cvut.cz/ucebna/matlab/techdoc/ref/rank.html.. I used this algorithm for this.
Star Strider
on 1 May 2015
That is exactly the code for the built-in MATLAB rank function. Please do not create your own versions of built-in MATLAB functions and save them with the same name as the original.
This runs for me without error:
Arank = rank(A)
producing:
Arank =
3
meaning that one row or column is linearly dependent.
Keti Kapa
on 2 May 2015
But I have to use MATLAB function to show that the rank of A is three.
Star Strider
on 2 May 2015
If you use the code I posted, you just did.
To use a MATLAB function does not imply that you have to copy it to a different function file — just use it as it exists.
Keti Kapa
on 2 May 2015
thankss :)
Star Strider
on 2 May 2015
My pleasure!
Keti Kapa
on 4 May 2015
Sorry :) Can you help me with this code. I want not to display "ans=0". Semicolon does not work. thanks
function y=davaleba(a);
a=input( ' matrix: ' ) % MATRIX IS [1 4 3 7; 2 6 8 3;1 3 4 5; 4 13 15 15];
y=det(a);
end
Star Strider
on 4 May 2015
I’m lost.
What are you doing?
Keti Kapa
on 4 May 2015
Plz can you run this command? and insert this matrix which I mentioned above. Determinant is zero and it displays in command window which I do not want, I used semicolon for that. still does not work
Star Strider
on 4 May 2015
When I run the det function with it independently, the deteminant is 0.
If you don’t want it displaying in the Command Window, you have to put the semicolon after the call to the function:
y=davaleba(a);
The semicolon after the first line of the function itself does nothing.
More Answers (0)
Categories
Find more on Structural Mechanics in Help Center and File Exchange
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)