Filter löschen
Filter löschen

i cant able to plot graph of this cord

2 Ansichten (letzte 30 Tage)
suketu vaidya
suketu vaidya am 8 Nov. 2020
Beantwortet: dpb am 8 Nov. 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

Antworten (1)

dpb
dpb am 8 Nov. 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);

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by