Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % calculations
- n = 20;
- ks = 1 : 20;
- combs_byTA = 1 : n;
- combs_Matlab = 1 : n;
- for k = 1 : 20
- combs_byTA( k ) = nchoosek_byTA( n, k );
- combs_Matlab( k ) = nchoosek( n, k );
- end
- % are they equal? print result to screen
- if isequal( combs_byTA, combs_Matlab )
- are_equal = 'equal';
- else
- are_equal = 'not equal';
- end
- fprintf( 'combs_byTA and combs_Matlab are: %s\n', are_equal );
- % plot the two graphs for visual comparison: plot( x, y );
- subplot( 2, 1, 1 );
- plot( ks, combs_byTA );
- title( 'Plot of combs_byTA' );
- subplot( 2, 1, 2 );
- plot( ks, combs_Matlab );
- title( 'Plot of combs_Matlab' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement