想让这个s以矩阵的形式输出,怎么做啊。
1 view (last 30 days)
Show older comments
皇家国际开户经理【微8785092】
on 18 May 2023
Answered: 皇家国际开户电话【微8785092】
on 18 May 2023
clear,clc
x=[2 5 9 12 15];
y=[8 -4 -9 3 -1];
x1=0:0.01:1;
for i=1:length(x1)
s=0;
for j=1:4
d=abs(x1(i)-x(j))+abs(0-y(j));
s=s+d;
end
s
end
s
想让这个s以矩阵的形式输出,怎么做啊
0 Comments
Accepted Answer
皇家国际开户电话【微8785092】
on 18 May 2023
仅供参考,s应该是向量吧
clear,clc
x=[2 5 9 12 15];
y=[8 -4 -9 3 -1];
x1=0:0.01:1;
for i=1:length(x1)
s=0;
for j=1:4
d=abs(x1(i)-x(j))+abs(0-y(j));
s=s+d;
end
s1(i)=s;
end
s1
0 Comments
More Answers (0)
See Also
Categories
Find more on 图像算术 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!