Matlab Matrcies in output interact with each other

1 次查看(过去 30 天)
clear
clc
close all
syms x
Mat1 = zeros(10,10);
Mat2 = zeros(10,10);
for j=1:10
for k=1:10
if j+1==k
Mat1(j,k)=sqrt(j);
Mat2(j,k)=-sqrt(j);
end
if k+1==j
Mat2(j,k)=sqrt(k);
Mat1(j,k)=sqrt(k);
end
end
end
disp(Mat1)
disp(Mat2)
  2 个评论
Ted Devine
Ted Devine 2021-8-10
when i run the code the matrices output as one big blob and combine together. I cant seem to get them to just sty apart

请先登录,再进行评论。

回答(1 个)

KSSV
KSSV 2021-8-10
fprintf('Mat1 = \n')
disp(Mat1)
fprintf('Mat2 = \n')
disp(Mat2)

类别

Help CenterFile Exchange 中查找有关 Numbers and Precision 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by