Code of Iterative method's test
2 ビュー (過去 30 日間)
古いコメントを表示
I wrote a code to solve a linear system using Successive Relaxation Iterative method
but I don't know how to add the test and write its code
can anyone help me
4 件のコメント
Matt J
2014 年 7 月 12 日
When you call the function with some sample input, do you get the output you expect? If so, what more is there to do?
回答 (2 件)
Roger Stafford
2014 年 7 月 12 日
It looks as though you might be testing to see if the square matrix, R, fails to be "diagonally dominant". If so, here is a method:
Ra = abs(R);
if any(sum(Ra,2)>2*diag(Ra))
display ('Test Failed')
end
4 件のコメント
Roger Stafford
2014 年 7 月 12 日
I don't see anything like my code in your 'proj.m' code. Where are you doing a test remotely resembling "any(sum(Ra,2)>2*diag(Ra))"? Nowhere do you have an 'any' command nor do you ever multiply anything by 2. You don't even have a 'sum' command!
If you want effective help here it would be best to explain your problem much more clearly than you have so far done. What precisely is your test supposed to accomplish and in what way is it related to the matrix you called 'R'?
参考
カテゴリ
Help Center および File Exchange で Matrix Computations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!