|
|
solving problem with variable two valuables
if i got that x change from 0 to 360 as angles and as it changes h1 changes so how can i write m file solve it for me plz if u know reply fast thnx for reading
sw=9810;w=6000;
r=.3;
for x=0:.01*pi:2*pi
a=((x*r^2)/2)-(.5*r^2*sin(x*180/pi));
fb=sw*4*a;fp=fb-w;
h1=(r+5)-(r*cos(x*pi/360));
h2=fp*4/(sw*pi*.2^2);
if h1==h2
disp(h1)
end
end
|
|
0
|
|
|
|
Reply
|
muhamed
|
12/25/2009 11:41:05 PM |
|
Not sure what you're trying to do, but yes, h1 will change with each
loop iteration.
However it does seem a little weird that you have pi in the numerator
of
h1=(r+5)-(r*cos(x*pi/360))
when x itself is a fraction of pi, but you have pi in the denominator
of h1=(r+5)-(r*cos(x*pi/360)) like you'd expect.
Also, did you know that there are sind() and cosd() functions that can
work in degrees directly?
Also since you're comparing h1 to h2 and they're both floating
numbers, you'd better understand section 6.1 of the FAQ:
http://matlabwiki.mathworks.com/MATLAB_FAQ
Even without considering the truncation error, you will never have
equality because you aren't sampling with high enough density - just
look at the values of h1 and h2 as it goes through - they barely get
within 1 of each other, much less equality.
|
|
0
|
|
|
|
Reply
|
ImageAnalyst
|
12/26/2009 12:14:52 AM
|
|
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <757e67fd-b7a8-429d-9187-aa726ce27027@19g2000vbq.googlegroups.com>...
> Not sure what you're trying to do, but yes, h1 will change with each
> loop iteration.
> However it does seem a little weird that you have pi in the numerator
> of
> h1=(r+5)-(r*cos(x*pi/360))
> when x itself is a fraction of pi, but you have pi in the denominator
> of h1=(r+5)-(r*cos(x*pi/360)) like you'd expect.
> Also, did you know that there are sind() and cosd() functions that can
> work in degrees directly?
>
> Also since you're comparing h1 to h2 and they're both floating
> numbers, you'd better understand section 6.1 of the FAQ:
> http://matlabwiki.mathworks.com/MATLAB_FAQ
> Even without considering the truncation error, you will never have
> equality because you aren't sampling with high enough density - just
> look at the values of h1 and h2 as it goes through - they barely get
> within 1 of each other, much less equality.
|
|
0
|
|
|
|
Reply
|
muhamed
|
12/26/2009 12:40:21 AM
|
|
"muhamed " <scoooty_23@yahoo.com> wrote in message <hh3iih$9rt$1@fred.mathworks.com>...
> if i got that x change from 0 to 360 as angles and as it changes h1 changes so how can i write m file solve it for me plz if u know reply fast thnx for reading
>
> sw=9810;w=6000;
> r=.3;
> for x=0:.01*pi:2*pi
> a=((x*r^2)/2)-(.5*r^2*sin(x*180/pi));
> fb=sw*4*a;fp=fb-w;
> h1=(r+5)-(r*cos(x*pi/360));
> h2=fp*4/(sw*pi*.2^2);
> if h1==h2
> disp(h1)
> end
> end
|
|
0
|
|
|
|
Reply
|
muhamed
|
12/26/2009 1:43:04 AM
|
|
|
3 Replies
317 Views
(page loaded in 4.069 seconds)
|
|
|
|
|
|
|
|
|