Find Critical Mach number graphically

4 visualizaciones (últimos 30 días)
Kyle
Kyle el 12 de Feb. de 2013
Hey,
I have to plot two curves to find the critical mach number in matlab. Very rusty at Matlab (been a few years). For the first curve I have to plot the Critical Pressure coefficient value vs. the Critical Mach number and the other curve is the Pressure coefficient (calculated with the minimum pressure coefficient at low speed) vs object mach number
my code thus far is:
Cpo = -0.65; Mcr = linspace(1,8,20); Minfin = linspace(0,1,20);
Ccrit = (2/(1.4*Mcr.^2))*(((((2+(.4*Mcr.^2))/2.4))^3.5)-1); Cp = Cpo/(sqrt(1-Minfin.^2));
plot(Mcr,Ccrit) plot(Minfin,Cp) grid
and I keep getting an error in the Ccrit and Cp lines. Any help is appreciated thanks
  7 comentarios
Kyle
Kyle el 12 de Feb. de 2013
Sorry but still don't completely understand where the error is completely
Brian B
Brian B el 12 de Feb. de 2013
You've probably figured it out by now, but you need to change use
Ccrit = (2./(1.4*Mcr.^2)) ...*(((((2+(.4*Mcr.^2))/2.4)).^3.5)-1);
% ^ ^
% | |
% Note the periods before the "/" and before the "^".
You will need to make a similar change to the equation for Cp.

Iniciar sesión para comentar.

Respuestas (3)

Teja Muppirala
Teja Muppirala el 12 de Feb. de 2013
You probably just need to change "/" to "./"
Remember, the dot indicates elementwise operations.
This works:
1./[1 2 3]
This does not:
1/[1 2 3]

Youssef  Khmou
Youssef Khmou el 12 de Feb. de 2013
hi Kyle : try this :
Cpo = -0.65;
Mcr = linspace(1,8,20);
Minfin = linspace(0,1,20);
Ccrit = (2./(1.4*Mcr.^2)).*(((((2+(.4*Mcr.^2))./2.4)).^3.5)-1);
%keyboard,
Cp = Cpo./(sqrt(1-Minfin.^2));
figure,
plot(Mcr,Ccrit),xlabel('Critical Mach number'), ylabel('Critical Pressure coefficient value')
figure,grid
plot(Minfin,Cp,'r'), xlabel('object mach number'), ylabel(' Pressure coefficient' );grid
  1 comentario
Youssef  Khmou
Youssef Khmou el 12 de Feb. de 2013
The erro exist only in power operator "^" you have to use element-wise ".^" .

Iniciar sesión para comentar.


Kyle
Kyle el 12 de Feb. de 2013
Thank you everyone, got it working. @ Youssef KHMOU, you are a saint thank you

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by