Please help me. I have a function, f=f(x). I want to find the co-ordinates of the points where the first derivative of the function is zero i.e I want to know the Matlab command/code that will give me the co-ordinates of the points where df(x)./dx==0.
Please let suggest me.
|
|
0
|
|
|
|
Reply
|
PRITAM
|
12/30/2010 9:46:07 PM |
|
PRITAM wrote:
> Please help me. I have a function, f=f(x). I want to find the
> co-ordinates of the points where the first derivative of the function is
> zero i.e I want to know the Matlab command/code that will give me the
> co-ordinates of the points where df(x)./dx==0.
>
> Please let suggest me.
In what form is the function? If it's symbolic, that's one route; if
it's a sampled form then
>> x=1:10;
>> y=(x-5).^2; % sample function
>> y(find([nan abs(diff(sign(diff(y))))]==2))
ans =
0
>>
--
|
|
0
|
|
|
|
Reply
|
dpb
|
12/30/2010 10:09:45 PM
|
|
On 12/30/2010 2:09 PM, dpb wrote:
> PRITAM wrote:
>> Please help me. I have a function, f=f(x). I want to find the
>> co-ordinates of the points where the first derivative of the function is
>> zero i.e I want to know the Matlab command/code that will give me the
>> co-ordinates of the points where df(x)./dx==0.
>>
>> Please let suggest me.
>
>
> In what form is the function? If it's symbolic, that's one route; if
> it's a sampled form then
>
> >> x=1:10;
> >> y=(x-5).^2; % sample function
> >> y(find([nan abs(diff(sign(diff(y))))]==2))
> ans =
> 0
> >>
>
> --
but the answer should be 5
EDU>> solve ( diff((x-5)^2,x),x )
ans =
5
--Nasser
|
|
0
|
|
|
|
Reply
|
Nasser
|
12/30/2010 10:36:43 PM
|
|
On 30/12/10 4:36 PM, Nasser M. Abbasi wrote:
> On 12/30/2010 2:09 PM, dpb wrote:
>> In what form is the function? If it's symbolic, that's one route; if
>> it's a sampled form then
>>
>> >> x=1:10;
>> >> y=(x-5).^2; % sample function
>> >> y(find([nan abs(diff(sign(diff(y))))]==2))
>> ans =
>> 0
> but the answer should be 5
>
> EDU>> solve ( diff((x-5)^2,x),x )
>
> ans =
> 5
The location is 5, but y(5) is 0, and so 0 is the y coordinate of the
point at which the first derivative becomes 0.
The OP was not specific about wanting x and y coordinates both, but I do
agree it would have been clearer to have displayed both.
|
|
0
|
|
|
|
Reply
|
Walter
|
12/30/2010 11:33:55 PM
|
|
"PRITAM " <ajpritam@gmail.com> wrote in message <ifiuiv$r9b$1@fred.mathworks.com>...
> Please help me. I have a function, f=f(x). I want to find the co-ordinates of the points where the first derivative of the function is zero i.e I want to know the Matlab command/code that will give me the co-ordinates of the points where df(x)./dx==0.
>
> Please let suggest me.
Thank you very much dear friend for suggesting me a good way.
Actually my equation is :
EDU>> R = (4.4/7)*10000*0.25*(cosd(B))^2*(k*h)^2*((cosd(A)/(cosd(B))^2)*(-(C+(C*E*(sind(t))^2.*(cosd(x-40)).^2)/(C+E*(cosd(t))^2))*(cosd(B))^2+1-((sind(B))^2)/(C+E*(cosd(t))^2))+(sind(A)*2*E*sind(t).*sind(x-40))./(C+E*(cosd(t))^2).*(cosd(t).*sind(B)+C.*sind(t).*cosd(x-40).*c
with all the constants such as A,B,C etc are defined before hand. My x is :
x=1:1:360;
Now I want to know the matlab command that will allow me to find the points where first derivative are zero
|
|
0
|
|
|
|
Reply
|
PRITAM
|
12/31/2010 12:04:05 AM
|
|
Walter Roberson wrote:
> On 30/12/10 4:36 PM, Nasser M. Abbasi wrote:
>> On 12/30/2010 2:09 PM, dpb wrote:
>
>>> In what form is the function? If it's symbolic, that's one route; if
>>> it's a sampled form then
>>>
>>> >> x=1:10;
>>> >> y=(x-5).^2; % sample function
>>> >> y(find([nan abs(diff(sign(diff(y))))]==2))
>>> ans =
>>> 0
>
>> but the answer should be 5
>>
>> EDU>> solve ( diff((x-5)^2,x),x )
>>
>> ans =
>> 5
>
> The location is 5, but y(5) is 0, and so 0 is the y coordinate of the
> point at which the first derivative becomes 0.
>
> The OP was not specific about wanting x and y coordinates both, but I do
> agree it would have been clearer to have displayed both.
That was left as "exercise for the student"...I was simply demonstrating
that it was indeed the inflection point (minimum in the specific case). :)
--
|
|
0
|
|
|
|
Reply
|
dpb
|
12/31/2010 12:38:26 AM
|
|
On 30/12/10 6:04 PM, PRITAM wrote:
> "PRITAM " <ajpritam@gmail.com> wrote in message
> <ifiuiv$r9b$1@fred.mathworks.com>...
>> Please help me. I have a function, f=f(x). I want to find the
>> co-ordinates of the points where the first derivative of the function
>> is zero i.e I want to know the Matlab command/code that will give me
>> the co-ordinates of the points where df(x)./dx==0.
>>
>> Please let suggest me.
>
> Thank you very much dear friend for suggesting me a good way.
>
> Actually my equation is : EDU>> R =
> (4.4/7)*10000*0.25*(cosd(B))^2*(k*h)^2*((cosd(A)/(cosd(B))^2)*(-(C+(C*E*(sind(t))^2.*(cosd(x-40)).^2)/(C+E*(cosd(t))^2))*(cosd(B))^2+1-((sind(B))^2)/(C+E*(cosd(t))^2))+(sind(A)*2*E*sind(t).*sind(x-40))./(C+E*(cosd(t))^2).*(cosd(t).*sind(B)+C.*sind(t).*cosd(x-40).*c
>
>
> with all the constants such as A,B,C etc are defined before hand. My x is :
> x=1:1:360;
> Now I want to know the matlab command that will allow me to find the
> points where first derivative are zero
You appear to have one or more bracket mismatches.
Your using of cosd() and sind() make it more troublesome to find the
appropriate locations, but that can be compensated for.
Guessing about where the () should go, and assuming that R is a
constant, differentiating the and solving for 0 in x under the
assumption that everything will be real-valued, generates what appears
to be 8 different ugly solutions each of which involves finding a root
of a quartic equation. Attempting to simplify those equations is taking
Maple a fair bit of work.
Substituting the numeric values before doing the solve() would make the
solutions much shorter.
|
|
0
|
|
|
|
Reply
|
Walter
|
12/31/2010 7:43:36 AM
|
|
|
6 Replies
374 Views
(page loaded in 0.239 seconds)
|