MATLAB: How to print the first 100 primes including 1 as a vector primes i need to print vectors containing all prime numbers less than 100, including 1 as 1 is usually not shown as a prime number in matlab. Thanks Best Answer p = [1 primes(100)]p = Columns 1 through 19 1 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 Columns 20 through 26 67 71 73 79 83 89 97 Related SolutionsMATLAB: How to print all prime numbers between 1 and 100 using a for loop num = 1:100 ; % numbers till 100 idx = isprime(num) ; % get logical indices of prime numebrs num(idx) % print the prime numbers ans = 1×25 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 MATLAB: How to decrease the number of points in a matrix I suggest http://www.mathworks.com/help/matlab/ref/spline.htmlx = 1 : length(psdn);x128 = linspace(x(1), x(end), 128);p128 = spline(x, psdn, x128);plot(x128, p128); Related QuestionPrimes functionHow to create a list where it shows the values from the list 1:N so that in the list it says which numbers are primeWhat proportion of students failed the course (i.e., got a mark of less than 50)
Best Answer