functions

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 日

0 投票

infr = @(x)[fix(x),rem(x,1)]
or:
function [in, fr] = infr(x)
in = fix(x);
fr = rem(x,1);
end

3 件のコメント

Jan
Jan 2012 年 5 月 1 日
I'm not happy about this homework solution. It would be more helpful, for Karen and the forum, if she learns how to ask a good question.
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

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2012 年 4 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by