how can i create in script y=cos(x), between (0,2*pi) linspace(0,1,n) and the angel is 10degrees using for (loop) and Disp and SprintF

9 views (last 30 days)
help :(
  7 Comments
mustafa alawneh
mustafa alawneh on 20 Oct 2018
cosd??! yes i realise that but i want to say that im student and new in matlab and i need the answer As soon as

Sign in to comment.

Accepted Answer

mustafa alawneh
mustafa alawneh on 20 Oct 2018
%sinefun3.m n=21; x=linspace(0,1,n); %x=2*pi*linspace(0,1,n); y=sin(2*pi*x); %y=sin(x); disp('hi ') disp(' k x(k) sin(x(k))') for k=1:n degrees = (k-1)*360/(n-1); disp(sprintf('%2.0f %3.0f %6.3f ',... k ,degrees,y(k))) end disp(' ') disp(sprintf('one Degree = %5.3e Radians ',... pi/180))

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!