我正在努力完成这项任务:
创建一个递归函数,它将n作为参数并创建一个这样的矩阵,在这种情况下n = 3:
0 1 2 3 2 1 0
1 1 2 3 2 1 1
2 2 2 3 2 2 2
3 3 3 3 3 3 3
Run Code Online (Sandbox Code Playgroud)
我已经想出了这个:
function AA = A(n)
if n == 0
AA (1,1) = 0;
else
AA = n*ones(n+1,2*n+1);
AA(1:n, [1:n, n+3:end]) = A(n-1);
end
end
Run Code Online (Sandbox Code Playgroud)
但输出似乎在RHS上有一个奇怪的转变:
0 1 2 3 3 2 1
1 1 2 3 3 2 1
2 2 2 3 3 2 2
3 3 …Run Code Online (Sandbox Code Playgroud) 我尝试使用以下命令压缩pdf文件:
gswin64c -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=test-compressed.pdf test.pdf
Run Code Online (Sandbox Code Playgroud)
我在test.pdf目录中,也可以打开它,但是当我执行命令时,出现以下错误,尽管应该使用-sOutputFile = test-compressed.pdf指定输出文件:
GPL Ghostscript 9.16: Device 'pdfwrite' requires an output file but no file was specified.
**** Unable to open the initial device, quitting.
Run Code Online (Sandbox Code Playgroud)