MATLAB: Doesn’t the graph display a line lineMATLAB t=0:.5:10; N_0=1; N=N_0*exp(.069314718*10); figure(1) plot(t,N) Best Answer Its because t and N have different dimension. Refer this problem. I have done little change to make it understandable.clccleart=0:.5:10;N_0=1;N=N_0*exp(t);plot(t,N) Related SolutionsMATLAB: The plot doesn’t show the line If you must use a loop, you need to subscript ‘f1’: f1(i) = 1/(10*i/(c+10));However a loop is not necessary. Using element-wise operations, this works: c = 3*10^8;f0 = 10^9;d0=10^3;i = 1:100;f1 = 1./(10*i/(c+10));fd = f1-f0;plot(i,fd)See Array vs. Matrix Operations for details. MATLAB: Subscript indices must either be real positive integers or logicals help line u1(0)=2 Positive integers are integers greater than 0. This works: h = 0.5;N = 10;u1(1)= 2 ;u2(1)= 3 ;t(1) = 2;for n=1:10 u1(n+1)=u1(n) +h*u2(n); u2(n+1)=u2(n) +h*(4*exp(0.8*t(n))-(0.5)*u1(n)); t(n+1)= t(n) + h ;endplot(u1,u2); Related QuestionThe plot doesn’t show the lineBucle doesn’t end
Best Answer