Filter löschen
Filter löschen

functions

1 Ansicht (letzte 30 Tage)
karen
karen am 30 Apr. 2012
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 Kommentar
Jan
Jan am 1 Mai 2012
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?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Andrei Bobrov
Andrei Bobrov am 30 Apr. 2012
infr = @(x)[fix(x),rem(x,1)]
or:
function [in, fr] = infr(x)
in = fix(x);
fr = rem(x,1);
end
  3 Kommentare
Geoff
Geoff am 1 Mai 2012
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 am 1 Mai 2012
+1 Geoff.
It could have been improved by "Any hints to get me started?", but she wasn't asking for a full solution

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by