How to generate the equations automatically for multiple number of times
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I want to generate these 4 equations (written below) multiple times,(V11, delta11, I11, phi11, V21,delta21,I21,Phi21 are measurements) For each sample of these 8 measurements i want to generate 4 more equations automatically.
e.g. if no of samples= 3, then i need to generate 12 equations automatically
Can anyone suggest a smarter way of doing that?
Thanks in advance! Farhan
F = [V11.*cos(delta11) - R1*I11.*cos(phi11)+X1*I11.*sin(phi11)-E3.*cos(delta31)+R3*I31.*cos(phi31)-X3*I31.*sin(phi31)
V11.*sin(delta11) - R1*I11.*sin(phi11)-X1*I11.*cos(phi11)-E3.*sin(delta31)+R3*I31.*sin(phi31)-X3*I31.*cos(phi31)
V21.*cos(delta21) - R2*I21.*cos(phi21)+X2*I21.*sin(phi21)-E3.*cos(delta31)+R3*I31.*cos(phi31)-X3*I31.*sin(phi31)
V21.*sin(delta21) - R2*I21.*sin(phi11)-X2*I21.*cos(phi11)-E3.*sin(delta31)+R3*I31.*sin(phi31)-X3*I31.*cos(phi31)]
0 comentarios
Respuestas (1)
Image Analyst
el 10 de Mayo de 2015
Why not write a function:
function F = GenerateF(V11, delta11, I11, phi11, V21,delta21,I21,Phi21)
F = [V11.*cos(delta11) - R1*I11.*cos(phi11)+X1*I11.*sin(phi11)-E3.*cos(delta31)+R3*I31.*cos(phi31)-X3*I31.*sin(phi31)
V11.*sin(delta11) - R1*I11.*sin(phi11)-X1*I11.*cos(phi11)-E3.*sin(delta31)+R3*I31.*sin(phi31)-X3*I31.*cos(phi31)
V21.*cos(delta21) - R2*I21.*cos(phi21)+X2*I21.*sin(phi21)-E3.*cos(delta31)+R3*I31.*cos(phi31)-X3*I31.*sin(phi31)
V21.*sin(delta21) - R2*I21.*sin(phi11)-X2*I21.*cos(phi11)-E3.*sin(delta31)+R3*I31.*sin(phi31)-X3*I31.*cos(phi31)]
Then just call the function whenever you need to with whatever inputs you have at the time.
4 comentarios
Walter Roberson
el 10 de Mayo de 2015
function F = GenerateF(V11, delta11, I11, phi11, V21,delta21,I21,Phi21)
F = @(R1, R2, R3, X1, X2, X3, E3) [V11.*cos(delta11) - R1*I11.*cos(phi11)+X1*I11.*sin(phi11)-E3.*cos(delta31)+R3*I31.*cos(phi31)-X3*I31.*sin(phi31)
V11.*sin(delta11) - R1*I11.*sin(phi11)-X1*I11.*cos(phi11)-E3.*sin(delta31)+R3*I31.*sin(phi31)-X3*I31.*cos(phi31)
V21.*cos(delta21) - R2*I21.*cos(phi21)+X2*I21.*sin(phi21)-E3.*cos(delta31)+R3*I31.*cos(phi31)-X3*I31.*sin(phi31)
V21.*sin(delta21) - R2*I21.*sin(phi11)-X2*I21.*cos(phi11)-E3.*sin(delta31)+R3*I31.*sin(phi31)-X3*I31.*cos(phi31)];
The return value will be a function in R1, R2, R3, X1, X2, X3, E3, that will have "bound in" the values of the parameters that you passed to the generating function.
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!