Borrar filtros
Borrar filtros

i cant able to plot graph of this cord

2 visualizaciones (últimos 30 días)
suketu vaidya
suketu vaidya el 8 de Nov. de 2020
Respondida: dpb el 8 de Nov. de 2020
function taska
h = 1;
x = -pi:0.01:pi;
d = 50;
y0 = -1;
c1=(y0-(d^2/(d^2+1)));
y=@(x)c1*exp(-diff(x))+d*(sin(x)/(d^2+1))+d^2*(cos(x)/d^2+1);
plot(x,y(x));
end

Respuestas (1)

dpb
dpb el 8 de Nov. de 2020
y=@(x)c1*exp(-diff(x))+d*(sin(x)/(d^2+1))+d^2*(cos(x)/d^2+1);
numel(diff(x)) is one less than numel(x) so the above will fail owing to mismatch in number of elements.
But, since
x=-pi:0.01:pi;
it is so that
diff(x) --> 0.01 % within rounding error
so may as well just write as
dx=0.01;
x=-pi:dx:pi;
exp_dx=exp(-dx);
y=@(x) c1*exp_dx+d*(sin(x)/(d^2+1))+d^2*(cos(x)/d^2+1);

Categorías

Más información sobre Graph and Network Algorithms 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