how do i print my conversion code?

조회 수: 1 (최근 30일)
Ann Lee
Ann Lee 2022년 4월 10일
편집: Image Analyst 2022년 4월 10일
(factorial(n))/(n.^n);
this series is divergence over n being over 170.
and i want to make this series being converges when n being over 1000.
to make converges,
i conversed of expression to 'exp(ln(f(x))) = f(x)'
i want to print when n= 170~1000, this series( 'exp(ln(f(n))) = f(n)' )'s sum and
find the result of sum is converges or divergence
and print sum of series's graph
how can i fix this code?
and can i know what should i type on my command window to print out graph?
function A=work5(x)
m=1;
y = 170:10:1000;
for k = y
n=1:k;
f(n)= sum(exp(ln(f(n))));
A(1,m)=f(n);
m=m+1;
end
fprintf('k-sum\t\t%-10s\n','series a)','C or D');
fprintf('%-d-sum\t\t%13.10f\t%13.10f\t%13.10f\n',[y; A]);
end

답변 (2개)

Image Analyst
Image Analyst 2022년 4월 10일
편집: Image Analyst 2022년 4월 10일
"what should i type on my command window to print out graph?".......
On the figure toolbar there should be a printer icon. Try using that.
Or, you can use exportgraphics() to save your plot to a file, and then use your operating system to print the image file just like you would for any image.
Or try
printdlg(gcf)
As far as the function itself, there is lots wrong with it.
  1. For one, you're requiring an x input argument but you never use it.
  2. n is not defined so f(n) will throw an error.
  3. f was not defined in advance to f(n)= sum(exp(ln(f(n)))); will fail because you try to use f before it's assigned.
There may possibly be more problems once you fix those problems.

Torsten
Torsten 2022년 4월 10일
편집: Torsten 2022년 4월 10일
cube = @(n)prod((1:n)/n);
n = 1:1000;
series_terms = arrayfun(cube,n);
series_values = cumsum(array);
series_values = series_values(170:10:end)
n = n(170:10:end)
plot(n,series_values)

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by