function using cramers rule

Hello,

I have spent several hours trying to write a function using cramer's
rule. Unfortunatly, I can't use any short cuts or built in functions
matlab already has. It has to be a three by three matrix with inputs
A and B and out puts X1,X2,and X3. Does anyone have any samples I
could study or suggestions for me?? Thanks for any help, I'm not
looking to copy anyones work I want to learn how to do it, just needs
some guidance or direction to go in Thanks.

Steve Dunn
0
ndunn (5)
4/10/2004 4:10:46 PM
comp.soft-sys.matlab 207250 articles. 1 followers. lunamoonmoon (258) is leader. Post Follow

6 Replies
274 Views

Similar Articles

[PageSpeed] 26
steve wrote:
>
>
> Hello,
>
> I have spent several hours trying to write a function using
> cramer's
> rule. Unfortunatly, I can't use any short cuts or built in
> functions
> matlab already has. It has to be a three by three matrix with
> inputs
> A and B and out puts X1,X2,and X3. Does anyone have any samples I
> could study or suggestions for me?? Thanks for any help, I'm not
> looking to copy anyones work I want to learn how to do it, just
> needs
> some guidance or direction to go in Thanks.
>
> Steve Dunn

Can you use the MATLAB function det()? If so, your problem is very
simple to solve; otherwise you will have to create a function to
compute determinants as well. Since you are only doing the three by
three case, you should be able to write the determinant explicitly.

This smells like a homework problem, which usually doesn't go over
well here.
0
4/10/2004 4:19:09 PM
Duane Hanselman wrote:
>
>
> steve wrote:
>>
>>
>> Hello,
>>
>> I have spent several hours trying to write a function using
>> cramer's
>> rule. Unfortunatly, I can't use any short cuts or built in
>> functions
>> matlab already has. It has to be a three by three matrix with
>> inputs
>> A and B and out puts X1,X2,and X3. Does anyone have any
samples
> I
>> could study or suggestions for me?? Thanks for any help, I'm
not
>> looking to copy anyones work I want to learn how to do it, just
>> needs
>> some guidance or direction to go in Thanks.
>>
>> Steve Dunn
>
> Can you use the MATLAB function det()? If so, your problem is very
> simple to solve; otherwise you will have to create a function to
> compute determinants as well. Since you are only doing the three by
> three case, you should be able to write the determinant explicitly.
>
> This smells like a homework problem, which usually doesn't go over
> well here.

Can not use det()
0
ndunn (5)
4/10/2004 4:21:45 PM
Duane Hanselman wrote:
>
>
> steve wrote:
>>
>>
>> Hello,
>>
>> I have spent several hours trying to write a function using
>> cramer's
>> rule. Unfortunatly, I can't use any short cuts or built in
>> functions
>> matlab already has. It has to be a three by three matrix with
>> inputs
>> A and B and out puts X1,X2,and X3. Does anyone have any
samples
> I
>> could study or suggestions for me?? Thanks for any help, I'm
not
>> looking to copy anyones work I want to learn how to do it, just
>> needs
>> some guidance or direction to go in Thanks.
>>
>> Steve Dunn
>
> Can you use the MATLAB function det()? If so, your problem is very
> simple to solve; otherwise you will have to create a function to
> compute determinants as well. Since you are only doing the three by
> three case, you should be able to write the determinant explicitly.
>
> This smells like a homework problem, which usually doesn't go over
> well here.

I have the four A,A1,A2,A3 determinants figured out in proper format
as far as a11*(a22*a23-a32*a23)etc I need help in naming the function
ie y=what to use the all the determinants that I have already
written?

Thanks for your assistance,
Steve
0
ndunn (5)
4/10/2004 4:51:01 PM
steve dunn wrote:

>
> Can not use det()

So, start with code that computes the determinant of a general 3 by 3
matrix. If you don't know how to do this, look it up. Computation of
the determinant can be found in lots of places. You may even find an
explicit expression for the determinant of a 3 by 3 matrix.

After than you need to call the determinant 4 times. Once to get the
determinant of the original matrix A. Then find the determinant of
the matrix that results when you replace the j-th column of A with
the right hand side vector in your equations to be solved. The ratio
of these determinants gives you x(1), x(2), and x(3).

If the above does not make sense to you, then you are not yet in a
position to think about solving the problem using MATLAB--you need to
learn the underlying academic material first. Only after that does it
make sense to think about using MATLAB.

Duane
0
4/10/2004 4:52:48 PM
Duane Hanselman wrote:
>
>
> Steve dunn wrote:
>
>>
>> Can not use det()
>
> So, start with code that computes the determinant of a general 3 by
> 3
> matrix. If you don't know how to do this, look it up. Computation
> of
> the determinant can be found in lots of places. You may even find
> an
> explicit expression for the determinant of a 3 by 3 matrix.
>
> After than you need to call the determinant 4 times. Once to get
> the
> determinant of the original matrix A. Then find the determinant of
> the matrix that results when you replace the j-th column of A with
> the right hand side vector in your equations to be solved. The
> ratio
> of these determinants gives you x(1), x(2), and x(3).
>
> If the above does not make sense to you, then you are not yet in a
> position to think about solving the problem using MATLAB--you need
> to
> learn the underlying academic material first. Only after that does
> it
> make sense to think about using MATLAB.
>

Duane thanks for your reply,

I have already figured out the the A and x1,x2,x3 determinants by
using cramers rule of substituting the B of A X = B into the 1st, 2nd
and 3rd row respectively or ith jth and kth row. I know how to solve
the equations and have already written out all the four equations for
solving x1,x2,x3 by using A1/A, A2/A, A3/A. I keep getting an input
A argument not defined when running the program? This is directing me
to my function = line? Any suggestions?
Thanks again for your assistance.

Steve
> Duane
0
ndunn (5)
4/10/2004 5:14:44 PM
steve wrote:

*snip*

> Duane thanks for your reply,
>
> I have already figured out the the A and x1,x2,x3 determinants by
> using cramers rule of substituting the B of A X = B into the 1st, 2nd
> and 3rd row respectively or ith jth and kth row. I know how to solve
> the equations and have already written out all the four equations for
> solving x1,x2,x3 by using A1/A, A2/A, A3/A. I keep getting an input
> A argument not defined when running the program? This is directing me
> to my function = line? Any suggestions?
> Thanks again for your assistance.

If your code isn't too long post it, the error message you receive, and the
way you call it to the group so we can take a look.

Also one additional resource that you may want to bookmark for future use:

http://www.mathworks.com/support/tech-notes/1200/1207.html

-- 
Steve Lord
slord@mathworks.com


0
slord (13691)
4/12/2004 1:17:21 PM
Reply:
Similar Artilces:

Regarding system function
Hi All, Please have a look the below program #include<stdlib.h> int i = system("pwd"); I compiled the above program in UNIX ,it got compiled and executed with out any errors.It prints the present working directory.Am having certain doubts about this program. 1) without main how it got executed 2)is the system funcion is static 3) is the shell had executed that system command if i write simply #include<stdlib.h> system("pwd") it's thwoing errors at ...

[News] Adaptive Integrated System Uses Linux
Alpha Bay to Launch AIRS Retail Software in New York ,----[ Quote ] | The Adaptive Integrated System ? AIRS ? is a completely new, | fifth-generation enterprise retail system based on proven, | state-of-the-art technologies that provide retailers with the | real-time information needed to optimize profits. | | [...] | | Alpha Bay AIRS enterprise retail system is built on a Linux | and Java based SOA/ESA platform environment through a Web 2.0 | interface and supports DB2, Oracle, SQL 2005, Netezza and | Teradata. `---- http://www.linuxelectrons.com/News/Application/Alpha_Bay_to_Launch_AIRS_...

using C library functions in C++
Hi, I am learning C++ and already have a good experience in C. We have some of the application in C which we want to move it to C++. Will there be any issue in using a C library function in C++. regards, Rajkumar.G On Sep 21, 11:51 am, mthread <rjk...@gmail.com> wrote: > Hi, > I am learning C++ and already have a good experience in C. We have > some of the application in C which we want to move it to C++. Will > there be any issue in using a C library function in C++. > > regards, > Rajkumar.G Appendix C.2 of the C++ standard discusses this issue in deta...

The right function
Hi, Don't know the right function to use here. I have a php file containing text only that will contain references to smilies formatted such as "... then I told him the punch line (wink) ..." - obviously I want to detect the (xxx) smilie and replace with an image. I can sort of do this using multiple lines of code like this ... $mytext= str_replace("(wink)", "<IMG SRC=\"wink.gif\">", $mytext); $mytext= str_replace("(smile)", "<IMG SRC=\"smile.gif\">", $mytext); $mytext= str_replace("(laugh)", &q...

global in Embedded MATLAB Function
I am adopting some MATLAB codes into some Embedded MATLAB Function blocks in my Simulink model. These codes contain 'global' functions which are not supported by Embedded MATLAB Function. How can I circumvent this problem? ...

Vonage Beats Back New York Ruling
http://zdnet.com.com/2100-1103_2-5253841.html By Ben Charny CNET News.com The New York State Public Service Commission can no longer require Vonage to file for a telephone operator's license, possibly foreshadowing an important regulatory win for the Net phone industry. U.S. District Court Judge Douglas Eaton's decision is temporary and he scheduled a January hearing to decide whether his ruling should become permanent. "I guess he did get the memo from Minnesota," a Vonage spokeswoman said Wednesday, referring to a U.S. District Court judge issuance of a...

regarding system function
Dear All, In Php If I send a command to system function then It will return 1 on success and 0 on failure. So based upon that value I can to further work. But In Python If I send a command to system function then It will return 0 only for both conditions(success and failure). So What I need to do for this. I want the result like php system function. regards Prabahar ________________________________________________________________________ Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony praba kar <prabapython@yahoo.co.i...

Re: Best Practice when using permanent files #7
Hi Gerhard, They do use where clauses the problem is that when the ranges are 2-4 years across multiple tables the joins get too large. What I'd like to see is the monthly or quarterly data externalized and then the DB2 query would only have to join the current quarter/month which is much more manageable in terms of i/o and CPU. ...

MATLAB function usage #2
Can anyone tell me if MATLAB automatically uses "pointer-type methods" behind the scenes to transfer data between the main program and function calls? I have a function that would be called hundreds of thousands of times from inside an iterative loop. Also, I have a huge data matrix which need be used inside this function and I am wondering if using that data matrix as an input to a function would significantly reduce the computational efficiency. If yes, then are there any clever ways for handling such issues? Thanks Look at nested functions. I think loren's blog answers yo...

Stem function
All How could we plot two sets of data with different colours using stem function on the same figure.? Please help !! thnks Jack "Jack Dean" <w106pjs@yahoo.com> wrote in message news:eee5b99.-1@webx.raydaftYaTP... > All > > How could we plot two sets of data with different colours using stem > function on the same figure.? > Please help !! > > thnks > Jack Put your data into two columns of the same array. If your data are not of the same length it's a little more complicated, but not much. >>stem(randn(10,2),randn(10,2)) OP: <SNIP wa...

periodic function in matlab function block
in my simulink project,I have to write a equation by "Matlab Function" block. my periodic equation (with Ts period) is as following: A = 5 ; 0 < t < Dmin*Ts A = exp(-(t - Dmin*Ts)/Ts) ; Dmin*Ts < t < Ts A(t+Ts) = A(t) %================================= i wrote following code in Matlab function block % code : function A = fcn(t) Ts = 2; Dmin = 0.25; m = floor(t/Ts); t1 = t - m*Ts; if t1>=0 && t1<=Dmin*Ts A = 5; elseif t1 > Dmin*Ts && t1 < Ts A = exp(-(t1-Dmin...

Launching Word attachments using DoVerb
Can someone help me. When I run the code below it launches the word attachment then closes it almost immediately. It still holds open word with no document loaded. Many thanks in advance. Set doc=db.GetDocumentByUNID(x) Set rtitem = doc.GetFirstItem( "body" ) If ( rtitem.Type = RICHTEXT ) Then Forall o In rtitem.EmbeddedObjects If ( o.Type = 1453 ) Then v= o.DoVerb( "&Open" ) Call doc.Save(True,True) End If End Forall End If ...

Detection of devices using JavaScript
Hi everyone, I need to find a way to detect the type of device and os calling an API using JavaScript. I preferable need to do this in some way more reliable than detecting the User Agent. Any ideas please? Thanks, Sithu.D On Thu, 15 May 2014 02:32:25 -0700, Sithu.D wrote: > I need to find a way to detect the type of device and os calling an API > using JavaScript. I preferable need to do this in some way more reliable > than detecting the User Agent. Any ideas please? Is this javascript operating inside a web browser, or is it a script interpreter embedded in some ...

directly using the non-default output argument from a function
Hi, Is there a way to make direct use of a non-default output argument from a function? In other words, suppose I have a function [out1,out2,out3] = func (x,y,z), is there a way to manipulate the call to func so that it just returns 'out3'? For instance, instead of >> [~,ind] = sort(x) >> do_something_with_indices( ind ) I'd like to do something like >> do_something_with_indices( some_clever_function( sort(x) ) ) Is there any 'subsref'-type magic that can be used here? I realize that the two-step procedure is clearer, but for my ...

Problems with Favorite function.
Every days I save a Favorite directory by the specific button but after the restart of the system Pro/eng 2000i2 forgets the path. Could someone to help me please? Thanks in advance for your support. It needs to be saved in your config.pro "UTE" <roberto.olivieri@cmsspa.it> wrote in message news:2pnuocFn7ph8U1@uni-berlin.de... > Every days I save a Favorite directory by the specific button but > after the restart of the system Pro/eng 2000i2 forgets the path. > > Could someone to help me please? > > Thanks in advance for your suppo...

Potential new recruit to Java. Could I/Should I use Java?
Hi, I'm writing a new ecommerce web application using Ruby on Rails. I'm working on the back end and am thinking about different ways to do it. So many choices. First, I prototyped the standard thing: HTML forms based backend/admin. Second, I tried a cool Rails based AJAX drag/drop interface. This is fun but then I realized that the more I moved in the AJAX direction the more I was was building a javascript application, just asking the server for some data and only infrequently asking for a page layout or complete refresh. Now I'm thinking of a third option I haven't used Jav...

Reset state of transfer function
Hi, Does anyone know how I can reset the state of a transfer function block in Simulink (i.e., reset back to the initial conditions)? I tried using an "Enabled Subsystem" and placing the Transfer Fcn block there but it seems that the state is not reset when Enable changes ... Thanks! On 9/2/2014 8:14 PM, Peter Mairhofer wrote: > Hi, > > Does anyone know how I can reset the state of a transfer function block > in Simulink (i.e., reset back to the initial conditions)? > > I tried using an "Enabled Subsystem" and placing the Transfer Fcn bl...

Proper Use of Volatile?
Can someone help me out here? This is one of those areas of C that I am fuzzy on. I'm not quite sure when I should use volatile. If you could provide an example, that would help out a lot. I know it has to do with the expectation that the variable can be changed outside of the control of the program. I know it has to do with telling the compiler to not optimize that piece of code, so that the variable can be changed from outside of the program. But I struggle with the thought process as to deciding when to use it. <OT> I was reading the source code for ftp (the client), and I ...

Can I use KNode without KWallet?
I do NOT want to use KWallet. As far as I can see, KNode is just as well able to remember my News password, but for some reason it 1. invokes KWallet as soon as I have entered my password 2. forgets my password I remember that it was different, and that I did not need KWallet at all (which is not too useful anyway, as it always pops up AFTER you have entered the password for a service). -- jjg <posted & mailed> jg wrote: > I do NOT want to use KWallet. As far as I can see, KNode is just as well > able to remember my News password, but for some reason it > 1. invokes KWa...

Boost function and bind issue
This code compiles: boost::asio::ip::tcp::acceptor m_acceptor; // declared in a class connector::pointer new_conn(new connector(m_acceptor.io_service())); m_acceptor.async_accept ( new_conn->socket(), boost::bind ( &timingserver::handle_accept, this, boost::asio::placeholders::error, new_conn ) ); So now I want to pull out the boost::bind part and make a function object of it. boost::function < void ( const boost::system::error_code &, boost:...

Using glut......... #2
Hello everyone, I am using GCC through DevC++ & Code Block Studio IDEs. I got libraries "gl" & "glu" with these IDEs. Programs based on these two libs gl & glu are executing well. I want to use "glut" library. So I downloaded glut package and copied it to respective folders i.e. to include\GL\glut.h lib\glut32.lib and %WinDir%\System\glut32.dll then I test a glut program; It complied successfully but while linking it gave me a list of errors. Which setting do I need to change ? If you know, Please guide me to overcome the problem !!! yours Advai...

Return Value of Function ?!?!
Hello, I have a problem with my function here. The Function read out a Description from a Norton Ghost Image File. This works mostly with this Function. The Problem is when i try to return the value "Chars" out of my function at the end of the Function like: .... FUNCTION = Chars END FUNCTION then i get an Error: Relational operator expected Line 230: FUNCTION = Chars when i try it like this: FUNCTION = LEN(Char) the function returns a numeric value. The Return Value of this function should be the Variable "Chars". Any Idea what went wr...

Re: Infinite value-can it be defined and used in comparisons?
D. ..I is a SAS missing value just like a dot is. The intent is that you can use it to code an observation as missing for some reason that is different from , say , .M If you want to set the value of a variable to the largest number that can be represented on your particular operating system, use the Constant function CONSTANT('BIG') This case returns the largest double-precision floating-point number (8-bytes) that is representable on your computer. Nat Wooding Environmental Specialist III Dominion, Environmental Biology 4111 Castlewood Rd Richmond, VA 23234 Phone:804-271-...

Calling functions from functions from functions ...
Lets say I have a function g(p,x) where x and p are of some defined type. I also have a function NewtonR which I can use like so: x = NewtonR(g,p,x0) There is also another function I want to call ImplicitTrap which can be done as: u = ImplicitTrap(g,p,u0,step,n) This function defines a function of g, and it is this function that I'd like to pass to NewtonR. Can it be done? Basically the code is implementing the implicit trapezoidal rule for numerical integration with the NR solver being used at each step with automatic differentiation being used to handle the differentiation. M...

Random Functionality
I want to create a script that has random functionality. I want the script to randomly choose between an unknown number of subroutines and run one of them. By "unknown" I mean that the neither names of the subroutines, the references to the subroutines, nor the number of subroutines are hard coded into the script, but are determined at runtime. This will allow me to add additional functions to the list of possible random functions without having to update any other portion of the script. If that is as clear as mud, the code sample below demonstrates what I want to do. I cam...