You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Fahrenheit-scriptet fra oppgave 1.2.2 fungerer, men det er rotete. Rydd opp med funksjoner. 

Utdelt kode

Script fra oppgave 1.2.2

fahrenheit.m
9/5*-20+32
9/5*0+32
9/5*18+32
9/5*37+32
9/5*100+32

 

Videoforklaring (22:20)

Del 1 (7:23)Del 2 (4:46)Del 3 (6:05)Del 4 (4:06)

 

Løsningsforslag

fahrenheit.m
cels2fahr(-20)
cels2fahr(0)
cels2fahr(18)
cels2fahr(37)
cels2fahr(100)
cels2fahr.m
function retur = cels2fahr(celsius)
    retur = 9/5*celsius + 32;
end
  • No labels