Posts

ppp

Euler’s Method MATLAB Program.   function[]=m_euler  h=0.1;  f=@(x,y) x.^2+y;  x=0:h:1;  y(1)=1;  n=length(x);  yp(1)=y;  maxit=10;  for i=2:n      yp(i)=y(i-1)+h*f(x(i-1),y(i-1));      s(i,1)=yp(i);      for j=2:maxit          s(i,j) = y(i-1)+(h/2)*(f(x(i-1),y(i-1))+f(x(i),s(i,j-1)));          if abs(s(i,j)-s(i,j-1))<10^(-6)                 y(i)=s(i,j);              break          end      end  end  fprintf('Appr. sol. y(%f)=%f',x(end),y(end))  plot(x,yp,'m--')  hold on  plot(x,y,'r--')  hold on  u=dsolve('Dy=x^2+y','y(0)=1','x');  u=eval(u);  plot(x,u,'b--')  legend('Appr. sol. by Euler','Appr. sol. by Modified Euler','Exact sol.')  end dsolve and ode45 y=dsolve('Dy=3*x+y/2','y...
 1. Perform the following data transfer operations .section .data value:     .int 42 .section .text .globl _start _start:      movl $100, %eax     movl %eax, %ebx      movl $1, %eax     movl $0, %ebx       int $0x80 2. 1. Consider the following source code fragment Int a,b,c,d;      a= (b + c)-d + (b*c) / d; Registration Number: 23ETCS002165 • Assume that b, c, d are in registers. Develop an assembly language program to perform this assignment statements. • Assume that b is in registers and c, d in memory. Develop an assembly language program to perform this assignment statements. Value of b= 7654 Value of c= 3110 Value of d=234 .section .text .globl _start _start:     movl $100, %eax     movl $200, %ebx     addl %eax, %ebx     movl %ebx, %eax     movl $2, %edx     mull %edx      movl $1, %eax...