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?

3 次查看(过去 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?

回答(1 个)

Sania Nizamani
Sania Nizamani 2018-9-6
That doesn't work.

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by