Info

This question is closed. Reopen it to edit or answer.

Need to have equipartition in my graph, but does not know how to do that.

1 view (last 30 days)
Hey everyone. I'm stuck with an assigment, where I have to make a graph with equipartition, which I think is n number of points, which has the same distance between each other. At first I have to do it for n=4 and then n=20. If someone could tell me, how I have to do it, it would help.
I have a Bisection script:
function [ a,b ] = s(a,b,tol)
%finds zero of f in [a,b] with accuracy TOL
%Usage: E.g.
%format long
fa=adapquad(a,tol)/adapquad(1,tol)-0.5;
fb=adapquad(b,tol)/adapquad(1,tol)-0.5;
if fa==0
b=a;
elseif fb==0
a=b;
elseif fa*fb>0
error('Inappropriate use');
else
while b-a>tol
m=(b+a)/2;
fm=adapquad(m,tol)/adapquad(1,tol)-0.5;
if fm==0
a=m;
b=m;
elseif fa*fm<0
b=m;
else
a=m;
fa=fm;
end
end
end
and my other script with the graph:
%Problem 3
f= @(x) ((0.3+7.8*x-14.1*x.^2).^2+(0.3+1.8*x-8.1*x^.2)^2)^(1/2);
%Initialize graph
s=0:0.01:1;
x=0.5+0.3*s+3.9*s.^2-4.7*s.^3;
y=1.5+0.3*s+0.9*s.^2-2.7*s.^3;
plot(x,y)
hold all
t=zeros(4,1);
I get my graph, even though there are some small errors, but that's not the thing. I just need to have points on my graph. My teacher told me, that zeros(4,1) would do it, but it does not seams to work.

Answers (0)

Community Treasure Hunt

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

Start Hunting!