Trying to plot a function

7 visualizaciones (últimos 30 días)
Evan Gehret
Evan Gehret el 14 de Dic. de 2023
Comentada: Dyuman Joshi el 15 de Dic. de 2023
I am trying to plot the following function and have the period after "theta_shock", but I am getting an error of "Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters"
theta_shock = 0:90
M = 2
g = 1.4
half_cone = atand((M^2*sind(theta_shock.)-1)/(M^2*(g+cosd(2*theta_shock.))+2))
plot(theta_shock,half_cone)
What am I doing wrong and how do I fix this?
  1 comentario
Dyuman Joshi
Dyuman Joshi el 14 de Dic. de 2023
@Evan Gehret, please respond to the answers given on your earlier questions.

Iniciar sesión para comentar.

Respuestas (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 14 de Dic. de 2023
Here is the fixed code:
theta_shock = 0:90;
M = 2;
g = 1.4;
half_cone = atand((M^2*sind(theta_shock)-1)./(M^2*(g+cosd(2*theta_shock))+2));
plot(theta_shock,half_cone)
  1 comentario
Dyuman Joshi
Dyuman Joshi el 15 de Dic. de 2023
The source of the error were the fullstops present after theta_shock
Removing them and using the element-wise division for numerator and denominator gave the correct output.

Iniciar sesión para comentar.

Categorías

Más información sobre Annotations en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by