필터 지우기
필터 지우기

Hi, I have a problem. Please help me!!!

조회 수: 3 (최근 30일)
SULE SAHIN
SULE SAHIN 2017년 10월 27일
댓글: Walter Roberson 2018년 4월 27일
Write a function called sindeg that takes a matrix input called deg. The function returns a matrix of the same size as deg with each of its elements containing the sine of the corresponding element of deg. Note that the elements of deg are given in degrees and not radians. As a second output, the function returns a scalar that contains the average value of the first output. You are not allowed to use the sind and cosd built-in functions, but the use of any other function is acceptable.
My answer is
function [sine, mean_sine] = sindeg(deg)
sine = ;
mean_sine = sum(sine) / length(deg);
I couldn't fill sine because I dont understand that. Please guide me about this.
  댓글 수: 3
Ahmos Sansom
Ahmos Sansom 2017년 10월 27일
You just need to convert the degrees to radians then...
function [sine, mean_sine] = sindeg(deg)
% Convert to radians
my_radians = deg * pi/ 180.0;
% Use the sin function
sine = sin(my_radians);
% Work out average
mean_sine = mean(deg);
end
Walter Roberson
Walter Roberson 2018년 4월 27일
Please do not close questions that have an answer.

댓글을 달려면 로그인하십시오.

답변 (1개)

Debolina Mahapatra
Debolina Mahapatra 2017년 11월 3일
편집: Debolina Mahapatra 2017년 11월 3일
function [sine, mean_sine] = sindeg(deg)
my_radians = deg * pi/ 180.0;
sine = sin(my_radians);
avg = (mean(sine));
mean_sine = sum(avg) / length(avg);
This will hopefully solve the problem :)

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by