i cant able to plot graph of this cord
2 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
dpb
on 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);
0 Comments
See Also
Categories
Find more on Particle & Nuclear Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!