Borrar filtros
Borrar filtros

hello, I am trying to evaluate an equation for L=0.5:0.1:3, α=0:0.1:1 and n=1:1:400. I am not sure how to use nested for loop for this.

2 visualizaciones (últimos 30 días)
equation Q=(P_H (1-e^(-2jπnα) )+P_L (e^(-2jπnα)-e^(-2jπn) ))/2πnj(jZ_o ξ tan(ωLξ/c)+R_v )
for L=0.5:0.1:3,
for α=0:0.1:1
for n=1:1:400.

Respuesta aceptada

Rik
Rik el 12 de Mzo. de 2018
You can use mesgrid to create arrays to calculate every unique combination of L, alpha and n. as far as I know, Matlab can only use variable names with the latin alphabet, so I renamed some of your symbols. Don't forget that division and multiplication have a different meaning in matrix calculus, and using a dot will result in element-wise operations.
[L,alpha,n]=meshgrid(0.5:0.1:3,0:0.1:1,1:1:400);
Q=(P_H.*(1-exp(-2*j*pi*n.*alpha) )+P_L.*(exp(-2*j*pi*n.*α)-exp(-2*j*pi*n) ))./(2*pi*n*j*(j*Z_o *zeta.* tan(omega*L*zeta/c)+R_v ))

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox 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