tag:blogger.com,1999:blog-7609247588345867886.post8137270300207572157..comments2024-03-20T14:50:53.112+05:30Comments on The Chemical Engineering Blog: Matlab Tutorial classes beginchemicalenghttp://www.blogger.com/profile/16697927026368592992noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-7609247588345867886.post-89441344773575600622008-02-16T20:46:00.000+05:302008-02-16T20:46:00.000+05:30There was only a small mistake..It should be n= (b...There was only a small mistake..<BR/>It should be <BR/>n= (b-a)/h;<BR/><BR/>not<BR/>n= (a-b)/h;<BR/><BR/>When u use it as n= (a-b)/h; it will give minus value to n and loop will assign minus values to array index..Ask, if u have any more questions..<BR/><BR/>x = linspace(0,1,10);<BR/><BR/>h = 0.01;<BR/><BR/>a=0;<BR/><BR/>b=1;<BR/><BR/>n= (b-a)/h;<BR/><BR/>y(1)=1;<BR/><BR/>x(1)=0;<BR/><BR/>for I = 1:n;<BR/><BR/>x(I+1)= x(I)+h;<BR/><BR/>y(I+1)= y(I)+ h*x(I);<BR/><BR/>end<BR/><BR/>[x,y]<BR/><BR/>plot(x,y);Miyuruhttps://www.blogger.com/profile/01968371667004592144noreply@blogger.comtag:blogger.com,1999:blog-7609247588345867886.post-60248461228349523802008-02-09T15:34:00.000+05:302008-02-09T15:34:00.000+05:30Thank you rt,I make it correct.Thank you rt,<BR/><BR/>I make it correct.Thushara Subasinghehttps://www.blogger.com/profile/12968293718436358942noreply@blogger.comtag:blogger.com,1999:blog-7609247588345867886.post-3006595799474817372008-02-08T22:04:00.000+05:302008-02-08T22:04:00.000+05:30I'm not a matlab expert, but don't mind looking at...I'm not a matlab expert, but don't mind looking at your problem, if you still haven't solved it.<BR/><BR/>I think your code got corrupted when you posted it. Is it one file or two? Where does each file start / end, and what's with the "?Anonymoushttps://www.blogger.com/profile/03579729263804028714noreply@blogger.com