Friday, February 8, 2008

Matlab Tutorial classes begin

Yesterday Matlab tutorial classes began. We learned the basics of solving differential equations and integral functions. Solving differential and integral function with matlab quite difficult at the very beginning but I try it independently.


Some .m files which are written by me. Do not evaluate me‼‼‼ this is only a beginning……..

x = 0:0.1:10;

y= length(x);

for I=1:y;

m(I)= [x(end-I)];

end

m;



Second Problem

Solving integral from 0 to 1 ,ydx where y=x

x = linspace(0,1,10);

h = 0.01;

a=0;

b=1;

n= (a-b)/h;

y(1)=1;

x(1)=0;

for I = 1:n;

x(I+1)= x(I)+h;

y(I+1)= y(I)+ h*x(I);

end

[x,y]

plot(x,y);

This .m file did not run, it gives a error message

Are there any MATLAB experts? Help me via comments

3 comments:

Unknown said...

I'm not a matlab expert, but don't mind looking at your problem, if you still haven't solved it.

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 "?

Thushara Subasinghe said...

Thank you rt,

I make it correct.

Miyuru said...

There was only a small mistake..
It should be
n= (b-a)/h;

not
n= (a-b)/h;

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..

x = linspace(0,1,10);

h = 0.01;

a=0;

b=1;

n= (b-a)/h;

y(1)=1;

x(1)=0;

for I = 1:n;

x(I+1)= x(I)+h;

y(I+1)= y(I)+ h*x(I);

end

[x,y]

plot(x,y);

Labels

ammonia fertilizer (1) ammonia manufacture (1) ammonia production technology (1) ammonia refrigeration (1) ammonia uses (1) biodegradable bags (1) biodegradable chemical (1) biodegradable material (1) biodegradable plastics (1) biodegradable resin (1) biofuel technology (1) biogas design (1) biogas generation (1) biogas plant (1) biogas power (1) biogas production (1) biogas systems (1) Blog domain (1) blog domains (1) blog hoster (1) blog hosting (1) blog web hosting (1) cheap domains (1) chemical process industry (1) cloud software (1) commercial machines (1) composting material (1) composting process (1) composting yard waste (1) conferences (1) confs (1) crude oil tankers (1) domain reselling (1) dow (1) dow chemical (1) dow chemicals (1) educational blog (1) educational blogging (1) educational blogs (1) energy security sri lanka (1) entrepreneurship (1) entrepreneurship workshop (1) female engineers (1) female engineers video (1) fuel cell technology companies (1) fuel cells technology (1) haber process ammonia (1) institution of chemical engineersinstitution of engineers (1) integrated solid waste management (1) ISWM sri lanka (1) methane biogas (1) offshore oil rig (1) offshore oil rig employment (1) offshore oil rigs (1) process control engineering (1) process engineering (1) process simulation (1) processing industry (1) recycling composting (1) recycling packaging (1) recycling plastics (1) recycling waste (1) registered domains (1) renewable energy technology (1) small business and entrepreneurship (1) software engineering process (1) student membership (1) systems engineering process (1) uses of ammonia (1) virtual credit cards (1) virtual prepaid credit cards (1) virtual prepaid visa credit cards (1) waste to energy (1) waste to energy facility (1) waste to energy plants (1)

Followers