Given below is a code and its output. But, I want to get the output as a 6 by 5 single matrix . how to get that?
1 次查看(过去 30 天)
显示 更早的评论
clear; close all; clc;
format short
% These are Inputs
h=25; t(1)=0; phi(1)=0; tf=100; n=ceil((tf-t(1))/h);
t(2)=t(1)+h;t=t(1):h:tf;K=2;J=2;
a=[1.1559e-03 7.4156e-03; 1.2113e-02 1.7887e-02; 2.4226e-02 3.5774e-02];
%Algorithm starts
for k=1:K+1
for j=1:J
a(k,j);
for i=1:n
t(i+1)=t(i)+h;
phi(i+1)=(phi(i)+h*f(t(i+1)))./(1+h.*a(k,j));
end
Output= phi(end,:)
end
end
% This is the function file used in the above code. %% function ft=f(t)
ft=t;
end
The output is: How to get this output as a single matrix?
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!