Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Zadanie A31
- // funkcja wykres
- function wykres
- a=2e-4; b=3e-5; Us=1.25; E=30; R=2.2e3;
- x=linspace(0,35,300);
- r=E/R-x/R;
- y1=a.*x.^5.*e.^(-x./Us)+b.*x.^(3/2);
- plot(x,r,'r',x,y1,'b'),grid
- // funkcja f
- function i=f(U)
- a=2e-4; b=3e-5; Us=1.25; E=30; R=2.2e3;
- i=a.*U.^5.*e.^(-U./Us)+b.*U.^(3/2)-E./R+U./R;
- // funkcja fprim
- function i=fprim(U)
- a=2e-4; b=3e-5; Us=1.25; E=30; R=2.2e3;
- i=5*a.*U.^4*e.^(-U./Us)+a.*U.^5*e.^(-U./Us).*(-1/Us)+3/2*b.*U.^(-1/2)+1/R;
- // funkcja newton
- function [U0,I0,k]=newton(U,delta)
- E=30; R=2.2e3;
- k=1;
- while (abs(f(U)) > delta)
- U=U - f(U) / fprim(U);
- k=k+1;
- if(k>50)
- 'za duzo'
- return;
- end
- end
- U0=U;
- I0=E/R-U/R;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement