Output equation answer from 1 to 50

This is probably a very simple question, but I have an equation that I need to have the output printed out from 1 to 50 by increments of 1, so I was just wondering how this would be done.

Answers (1)

f=@(x)x.^2.*sin(x)-x.*cos(x);%any equation of one variable
f(1:50)%prints to command window with no ;

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Asked:

on 12 Mar 2021

Answered:

on 12 Mar 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!