Borrar filtros
Borrar filtros

Implementing a calculation in matlab

13 visualizaciones (últimos 30 días)
Shubham Kapoor
Shubham Kapoor el 12 de Feb. de 2015
Comentada: Shubham Kapoor el 27 de Mzo. de 2015
I calculate distance d1,d2 and d3 as 2*r1*sin(2*pi/n1) and 2*r2*sin(pi/n2) and 2*r3*sin(pi/n3) By taking d1=d2=d3 n1=4,n2=8 n3=16 I equated d2 d3 to d1 to get r2 and r3 in terms of r1 Then I have the equation
(1/32)*(n1*r1^2+n2 *r2^2+n3*r3^2) =1 I substituted r2 and r3 in terms of r1 and solved to get optimum radius r1 and r2. Its easy to do this manually.But,My problem was in writing this in Matlab
As r1 is an unknown variable.Can someone advise me on calculating this in Matlab.
Thanks

Respuesta aceptada

Aayushi Agarwal
Aayushi Agarwal el 13 de Feb. de 2015
you're going to have to manipulate your equation "(1/32)*(n1*r1^2+n2 *r2^2+n3*r3^2) =1" so that it is solving for r1. using what you have for d1 = d2 = d3, you can solve for r2 and r3 in terms of r1. that makes manipulating the equation given so that "r1 = ......." easier. you can then input your work into matlab.
once you input your n1, n2, and n3 values into matlab, you can input the "r1 = ..." equation in to solve for r1. then to solve for r2 and r3, you just have to input the equations that you manipulated to solve for r2 and r3 in terms of r1.
see code below.
n1 = 4;
n2 = 8;
n3 = 16;
r1 = 32 / (n1 + n2*((sin(0.5*pi)/sin(pi/8))^2)+n3*((sin(0.5*pi)/sin(pi/16))^2))
r2 = r1*sin(0.5*pi)/sin(pi/8)
r3 = r1*sin(0.5*pi)/sin(pi/16)
hope this helped!

Más respuestas (0)

Categorías

Más información sobre Operating on Diagonal Matrices 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!

Translated by