how do i print my conversion code?

1 visualización (últimos 30 días)
Ann Lee
Ann Lee el 10 de Abr. de 2022
Editada: Image Analyst el 10 de Abr. de 2022
(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

Respuestas (2)

Image Analyst
Image Analyst el 10 de Abr. de 2022
Editada: Image Analyst el 10 de Abr. de 2022
"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 el 10 de Abr. de 2022
Editada: Torsten el 10 de Abr. de 2022
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)

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by