plotting two functions on the same trendline in matlab -
this original code:
function = graph_times() merge_times = []; = 100:100:1000 curr = sort_timer(i); merge_times = [merge_times, curr(1)]; end plot(100:100:1000, merge_times); = 1; end
i want modify code plots trendlines both insertion_sort
, merge_sort
on same graph. below functions merge_sort
, insertion_sort
function c = insertion_sort(list1) inserted = []; = 1:size(list1,2) inserted = insert_in_order(inserted,list1(1,i)) c = inserted end steps2=0; function b = merge_sort(nums) if size(nums,2) == 1 b = nums; return; end
you can give several sets of coordinates matlab's plot
function. can plot times of 2 sorting algorithms so:
plot(100:100:1000, merge_times, 100:100:1000, insertion_times);
Comments
Post a Comment