필터 지우기
필터 지우기

functions

조회 수: 1 (최근 30일)
karen
karen 2012년 4월 30일
I have to write a matlab function, function [in,fr]=infr(x) that takes an array x of real numbers and returns arrays in and fr holding the integral and fractional parts respectively of all the numbers in array x but don't know where to start.
  댓글 수: 1
Jan
Jan 2012년 5월 1일
You don't know, where to start. The give us some tips: Do you have a computer already? With installed operating system? Did you install Matlab already? Do you know how to write a function and save it as M-file? Did you try anything to solve your homework by your own?

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

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2012년 4월 30일
infr = @(x)[fix(x),rem(x,1)]
or:
function [in, fr] = infr(x)
in = fix(x);
fr = rem(x,1);
end
  댓글 수: 3
Geoff
Geoff 2012년 5월 1일
Often, I think, when a student doesn't know where to begin they also don't know how to ask the right question.
Richard Brown
Richard Brown 2012년 5월 1일
+1 Geoff.
It could have been improved by "Any hints to get me started?", but she wasn't asking for a full solution

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

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by