<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'unknown error' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'unknown error' posted on the 'Matlab' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2012 Programmers Heaven</copyright>
    <pubDate>Thu, 09 Feb 2012 10:23:14 -0800</pubDate>
    <lastBuildDate>Thu, 09 Feb 2012 10:23:14 -0800</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>unknown error</title>
      <link>http://www.programmersheaven.com/mb/ctocplusplustomatlab/410964/410964/unknown-error/</link>
      <description>Hi all,&lt;br /&gt;
I'm new to Matlab, this is my first matlab question and i used lots of time to solve it but there are some unknown problem that i cant solve.&lt;br /&gt;
&lt;br /&gt;
Question:&lt;br /&gt;
Write a MATLAB program, in a m-file that determines the solution of the equation 8-4.5(x-sin x)=0 by using bisection method. The solution should have approximation eorr of less than 0.001%. Create a table that display the value of X1 , Xu , f(x)f(y) and Ea for each iteration of the bisection process.&lt;br /&gt;
&lt;br /&gt;
My current answer after a week of solving:&lt;br /&gt;
a = 2&lt;br /&gt;
b = 3&lt;br /&gt;
for x=a:b&lt;br /&gt;
y(a)=8-4.5*(x-sin(x))&lt;br /&gt;
y(b)=8-4.5*(x-sin(x))&lt;br /&gt;
c = (a + b)/2&lt;br /&gt;
for x=c&lt;br /&gt;
y(c)=8-4.5*(x-sin(x))&lt;br /&gt;
end&lt;br /&gt;
if y(c)==0&lt;br /&gt;
answer = y(c), break,&lt;br /&gt;
elseif y(a)*y(c)&amp;lt;0&lt;br /&gt;
a=c&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
----------------------------------------------&lt;br /&gt;
I got this error message,&lt;br /&gt;
??? Attempted to access y(2.5); index must be a positive integer or logical.&lt;br /&gt;
&lt;br /&gt;
Error in ==&amp;gt; Untitled at 8&lt;br /&gt;
y(c)=8-4.5*(x-sin(x))&lt;br /&gt;
------------------------------------&lt;br /&gt;
Your help and guidance is appreciated. Thanks&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ctocplusplustomatlab/410964/410964/unknown-error/</guid>
      <pubDate>Sat, 19 Dec 2009 12:57:50 -0800</pubDate>
      <category>Matlab</category>
    </item>
    <item>
      <title>Re: unknown error</title>
      <link>http://www.programmersheaven.com/mb/ctocplusplustomatlab/410964/411305/re-unknown-error/#411305</link>
      <description>Hello &lt;br /&gt;
&lt;br /&gt;
You made a mistake in your division. Your reply was an c = (a + b)/2.&lt;br /&gt;
The result of this is 2.5, if you want to use this as an matrix index (or array index) it must be an integer. It is possible for you to do a type cast to convert its type.&lt;br /&gt;
&lt;br /&gt;
Example 1:&lt;br /&gt;
y(int(c))=8-4.5*(x-sin(x))&lt;br /&gt;
&lt;br /&gt;
int(2.5) = 2&lt;br /&gt;
&lt;br /&gt;
Example 2:&lt;br /&gt;
round(2.5) = 3&lt;br /&gt;
&lt;br /&gt;
Or you have to avoid an non-integer result. Negative integers are not allowed.&lt;br /&gt;
&lt;br /&gt;
Kind regards,&lt;br /&gt;
Frank.</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ctocplusplustomatlab/410964/411305/re-unknown-error/#411305</guid>
      <pubDate>Mon, 28 Dec 2009 07:07:12 -0800</pubDate>
      <category>Matlab</category>
    </item>
  </channel>
</rss>
