Changeing the x Values when you plot the values
조회 수: 9 (최근 30일)
이전 댓글 표시
Hi! I have a problem with plotting in the way it is supposed to be. I am supposed to plot the average time of solving a matrix with x = inv(A)*b;* When i plot the values of my function the x-values should go from "n=100:10:500". But when you store those values in a array the array will be filled with zeroes beacuse its storing in 100,110,120,,,etc. The elements in between will be zero, so when you plot the graph it also considers the zeroes as values. So i stored each value in an array to goes from 1-40 instead. Is there away to change the x of each element so that when i plot it, it will go from n=100-500?
Thank you for your time
t = zeros(1,200);
s = zeros(1,40);
r = 1;
for n = 100:10:500
for i = 1:1:200
A = rand(n,n);
b = rand(n,1);
tic;
x = inv(A)*b;
t(i) = toc;
end
s(r) = mean(t);
r = r + 1;
end
plot(s)
xlabel('Matrixes from 100 x 100 to 500 x 500')
ylabel('Averge solving time in seconds for x = inv(A)*b')
댓글 수: 0
채택된 답변
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Uncertainty Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!