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?

回答 (1 件)

Sania Nizamani
Sania Nizamani 2018 年 9 月 6 日
That doesn't work.

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by