I have all of the answers to this can someone just actually explain this matlab code and the results to me so i can get a better understanding?
b)
(c) and (d)
%% Matlab code %%
clc;
close all;
clear all;
format long;
f=@(t,y)y*(1-y);
y(1)=0.01;
%%%% Exact solution
[t1 y1]=ode45(f,[0 9],y(1));
figure;
plot(t1,y1,'*');
hold on
% Eular therom
M=[32 64 128];
T=9;
fprintf(' M Max error \n' );
for n=1:length(M)
k=T/M(n);
t=0:k:T;
for h=1:length(t)-1
y(h+1)=y(h)+k*f(t(h),y(h));
end
plot(t,y);
hold on
%%% Exact solution
[t y2]=ode45(f,t,y(1));
Mer=max(abs(y2-y'));
fprintf(' %d %f \n',M(n),Mer);
end
legend('Exact solution','M=30','M=64','M=128');
xlabel('t');
ylabel('y(t)');
OUTPUT:
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
I have all of the answers to this can someone just actually explain this matlab code and the results to me so i can get a better understanding? b) (c) and (d) %% Matlab code %% clc; close all; clear...
i really just need help with part c and d. thank you! (a)Use Euler method to find the difference equation for the following IVP (initial value problem). Please Type your work. (Due on March 5th) dt(, yo 0.01 (b) Calculate the numerical solution for 0 s t S T using k and M T where k = and T = 9 for M 32,64, 128. Using programming languages such as Ct+, MATLAB, eto. (c) Graph those numerical solutions versus exact...
Hi I need help understanding this matlab code. Can you add comments or at least state what the lines in this code are doing. Thanks! close all; clear all;clc; t=1:0.025:5; desired=5*sin(2*3.*t); noise=5*sin(2*50*3.*t); refer=5*sin(2*50*3.*t+ 3/20); primary=desired+noise; subplot(4,1,1); plot(t,desired); ylabel('desired'); subplot(4,1,2); plot(t,refer); ylabel('refer'); subplot(4,1,3); plot(t,primary); ylabel('primary'); order=2; mu=0.005; n=length(primary) delayed=zeros(1,order); adap=zeros(1,order); cancelled=zeros(1,n); for k=1:n, delayed(1)=refer(k); y=delayed*adap'; cancelled(k)=primary(k)-y; adap = adap + 2*mu*cancelled(k) .* delayed; delayed(2:order)=delayed(1:order-1); end subplot(4,1,4); plot(t,cancelled); ylabel('cancelled');
t0 = 0; tf = 20; y0 = [10;60]; a = .8; b = .01; c = .6; d = .1; [t,y] = ode45(@f,[t0,tf],y0,[],a,b,c,d); u1 = y(:,1); u2 = y(:,2); % y in output has 2 columns corresponding to u1 and u2 figure(1); subplot(2,1,1); plot(t,u1,'b-+'); ylabel('u1'); subplot(2,1,2); plot(t,u2,'ro-'); ylabel('u2'); figure(2) plot(u1,u2); axis square; xlabel('u_1'); ylabel('u_2'); % plot the phase plot %---------------------------------------------------------------------- function dydt = f(t,y,a,b,c,d) u1 = y(1); u2 = y(2); dydt = [ a*u1-b*u1*u2 ; -c*u2+d*u1*u2 ]; end Only...
Can you please help me with this question. Much appreciated. So I have a sample code, but we need to change the code in a way that fits the problem. A planar slab of material is initially at a temperature of 300 K. At the time t=0, microwave radiation is directed at the material, leading to internal heat generation that is uniform within the material. The sides of the slab experience negligible heat losses and a water bath maintains the...
I DESPERATELY NEED HELP WITH THIS DIFFERENTIAL EQUATIONS MATLAB ASSIGNMENT IM SUPPOSED TO BE LEARNING BUT WE HAVE A SUB AND HE DIDN'T TEACH IT! ITS EULER AND IMPROVED EULER IN MATLAB! HERE IS THE LINK FOR THE IMAGE FILE THAT SHOWS THE FULL INSTRUCTIONS FOR THE CODE. https://imgur.com/a/gjmypLs Also, here is my code so far that I borrowed form an old assignment but the data is all wrong and the application of the code is slightly different so either...
I got stuck on these two steps, can someone help me ? ACCOUNTING CYCLE STEP 3: Post each trans me general ledger working papers provideo teach transaction in the general journal to the general ledger. Use s provided in your packet. Posting is the process of transferring general journal entry information to the seneral ledger. Fach number you post should be properly Cross-referenced Helpful Hints by: recording the general journal page number (ex. G1, G2, etc.) in the Posting Reference...