Advertisement
STANAANDREY

Untitled

May 28th, 2023
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. close all
  2. ev=[1.209 4.055 9.387 18.48 27.58 35.66 39.86 49.13 53.97 56.72 66.63 70.65 75.13 80.11 85.7 92.02 93.38 95.49 96.94 99.19 100.7 106.53 107.42 110.13 112.94 114.9];
  3. re=[61 19.3 10.2 6.1 4.5 3.7 3.4 2.9 2.7 2.6 2.3 2.2 2.1 2 1.9 1.8 1.78 1.75 1.73 1.7 1.68 1.61 1.6 1.57 1.54 1.52]';
  4. CCoef=@(ev)[1 -log(ev)];
  5. m = length(ev);
  6. n = length(CCoef(NaN));
  7. A=zeros(m, n);
  8. for i=1:m
  9. A(i,:)=CCoef(ev(i));
  10. end
  11. ATA=A'*A;
  12. ATB=A'*re;
  13. c=ATA\ATB;
  14. predfn=@(ev)(c(1)-c(2)*log(ev));
  15. fplot(predfn, [-1 115], 'red')
  16. hold on
  17. plot(ev, re', '*')
  18. xlabel('iluminare[lx]')
  19. ylabel('R[kOhm]')
  20. title('caracteristica fotorezistor')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement