:Matlab program with these equations

  • Thread starter armin11
  • Start date
  • Tags
    Program
In summary: Matlab programmer with the following skills:- Experience using Matlab for scientific computing- Familiarity with the Optimization Toolbox- Experience with curved surface analysis, e.g. using Surfaces in MeshIn summary, SIRCORP is looking for a Matlab programmer with the skills listed above.
  • #1
armin11
66
0
urgent:Matlab program with these equations

Question:For an oblique shock in air, write a computer program to calculate and plot β , M2 ,p2/p1,p02/p01 versus M1 for various θ . Show the Mach wave and normal shock wave limits and the line of maximum deflection angle on the plot.

I've written the below equations but i can't write a program in MATLAB to use these,please help me.

equations:
(in the below equations: a=θ , s=β ,gam=1.4)
cot(a) = tan(s) * [{((gam+1) * M^2)/(2 * M^2 * sin^2(s) - 1)} - 1]

M1^2 * sin^2(s -a) = [(gam-1)M^2 sin^2(s) + 2] / [2 * gam * M^2 * sin^2(s) - (gam -1)]

p02 / p01 = {[(gam + 1) * M^2 * sin^2(s)]/[(gam-1)*M^2 * sin^2(s) + 2]}^[gam/((gam-1)] * {(gam+1)/[2 * gam * M^2 * sin^2(s)-(gam-1)]}^[1/(gam-1)]

p2/ p1 = [2 * gam * M^2 * sin^2(s)-(gam -1)] / (gam + 1)

(M2*sin(a-s))^2=[(1+(gam-1/2)*(M1*sin(a))^2)/(gam*(M1*sin(a))^2-(gam-1)/2)]
 
Physics news on Phys.org
  • #2


Are these equations exactly what you wrote in Matlab? If so then your variable names are wrong. Use names like Cot_a and Po2_Po1.

Also a hint in matlab, is that you can use an ellipses "..." to extend your equation to another line.

Code:
 A = add_1 + add_2 + add_3 + add_4 + ...
              add_5 + add_6
 
  • #3


No,these are not the codes that i wrote in MATLAB and "cot" means cotangent and is not a variable,my problem is that i don't know how to define these variables,for example we have only theta=[0:0.01:2*pi] then we have M1 and betha undefined but we have their formulas,how can I write a code for these?!
 
  • #4


About a year ago I wrote a code similar to this, if not, exactly the same. I can't find the code now, however, from what I remember, you simply have to assume a range of angles and Mach numbers and hope your solution lies somewhere in that range. If not, just keep going until it does. You can make a look up table also.
 
  • #5


It doesn't work,No one to help?!
 
  • #6
Matlab: Air in water

Can some one direct me to right place. : This is what I wish to do

Hot Air is bubbled through water. Water is contained in a tank which is cold to start with. Hot air is bubbled through this tank(from bottom inlet uniformly distributed using a sparger)

I wish to develop an MATLAB model how hear gets transferred from AIR to WATER. AIR is continuously flowing and water is in normal condition but Water to Air ratio is around 60% which means at any given time 30% space is taken by AIR int he entire tank.

At the top Air is Escaping from the Tank to atmosphere and tank is not under any pressure.
 
  • #7


armin11 said:
It doesn't work,No one to help?!

The problem is that you're trying to solve systems of non-linear equations. If I read correctly, your first two equations can be used to solve for beta ([itex]\beta[/itex]) and M (not sure if that's M1 or M2), for a given theta ([itex]\theta[/itex]).

Based on a cursory look at the equations, you'll probably have to use numerical methods to solve these. There is some of this in the Optimization toolbox, but the point of your homework is to probably code your own. Nevertheless, a bit of a starting point:
http://www.chemeng.queensu.ca/courses/CHEE222/Matlab/OnlineTutorial2.pdf
http://www.mathworks.com/help/toolbox/optim/ug/fsolve.html
 
Last edited by a moderator:
  • #8


thanks buddy,this helps a lot :D
 
  • #9


When i try to solve the equations with 'solve' it gives this error:System is inconsistent. Solution does not exist.
Apparently the usual equation solvers doesn't work on this and it needs something more mathematical,who knows how to fix this?
 
  • #10


Thanks Boss

That is off great help.

SIRCORP
 

What is Matlab?

Matlab is a high-level programming language and interactive environment commonly used in scientific and engineering applications.

What are the main features of Matlab?

Matlab has a variety of features including matrix manipulation, data analysis and visualization, and the ability to create and run complex algorithms.

Can Matlab be used for solving equations?

Yes, Matlab has a built-in solver that can handle a wide range of equations, including algebraic, differential, and integral equations.

How do I create a program in Matlab?

To create a program in Matlab, you can use the built-in editor or write your code in a separate text file and run it within the Matlab environment.

Is Matlab suitable for all types of scientific research?

Matlab is commonly used in fields such as engineering, mathematics, physics, and biology. It may not be suitable for all types of research, but it can be a powerful tool in many scientific disciplines.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
826
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
6K
  • Introductory Physics Homework Help
Replies
5
Views
743
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
520
  • Introductory Physics Homework Help
Replies
6
Views
204
  • Engineering and Comp Sci Homework Help
Replies
8
Views
3K
  • Introductory Physics Homework Help
2
Replies
38
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
3K
Back
Top