Đang chuẩn bị liên kết để tải về tài liệu:
A Guide to MATLAB for Beginners and Experienced Users phần 10

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Khi bạn gặp một lỗi cú pháp, xem xét dòng đầu vào của bạn một cách cẩn thận cho những sai lầm trong đánh máy. Nếu người dùng có ý định để tính toán 2 lần -4, vô tình chuyển các biểu tượng, kết quả là | Solutions to Practice Set C Developing Your MATLAB Skills 273 d Next we halve both f2 @ V f V 1.5 1000 10 -5 2 .0025 2 fzero f2 0 0.5 ans 0.0071 The voltage is less than in part b but more than in part c . e X 10. 0 -1 -5 f3 @ V x f V 1.5 1000 10 -5 x .0025 x VD 0 5 initialize vector of VD-values for j 1 6 f4 @ V f3 V X j VD j fzero f4 0 X j 10 end loglog 10 -5 X VD x- xlabel I_0 ylabel V_D 0 The loglog plot appears linear. This suggests that VD is roughly a constant times a power of I0. 11. a dsolve Dx x - x 2 274 Solutions to the Practice Sets ans 1 1 exp -t C1 syms x0 sol dsolve Dx x - x 2 x 0 x0 sol 1 1-exp -t -1 x0 x0 Note that this includes the zero solution indeed bettersol simplify sol bettersol -x0 -x0-exp -t exp -t x0 subs bettersol x0 0 ans 0 b We have already solved the equation in a above so all we need to do is to substitute the initial conditions in for x0 and plot the results. We increase the Linewidth from its default value so that the zero solution stands out better. T 0 0.1 5 cla reset hold on solcurves @ t x0 eval vectorize bettersol for initval 0 0.25 2.0 plot T solcurves T initval Linewidth 1.5 end axis tight title Solutions of Dx x - x 2 with x 0 0 0.25 . 2 xlabel t ylabel x hold off Solutions to Practice Set C Developing Your MATLAB Skills 275 The graphical evidence suggests that the solution that starts at zero stays there all the others tend toward the constant solution 1. c To use ode45 we want to write the differential equations as a single equation in a vector variable x. Its two components represent the two populations x and y. cla reset hold on f @ t x x 1 - x 1 2 - 0.5 x 1 x 2 . x 2 - X 2 2 - 0.5 x 1 x 2 for a 0 1 12 13 12 for b 0 1 12 13 12 t xa ode45 f 0 3 a b plot xa 1 xa 2 end end axis 0 13 12 0 13 12 hold off 1 0.8 0.6 0.4 0.2 0.-------Al------------------Al-------Al--------- 0 0.2 0.4 0.6 0.8