How to convert 'C' language code into Matlab??

5 visualizaciones (últimos 30 días)
mina
mina el 29 de Mzo. de 2013
Comentada: James Tursa el 23 de Abr. de 2020
How to convert 'C' language code into Matlab??
  1 comentario
Hari Priya
Hari Priya el 27 de Mzo. de 2019
Editada: James Tursa el 23 de Abr. de 2020
#include<stdio.h>
#include<math.h>
int main(){
float x1,y1,x2,y2,vx,vy,len,x3,y3,size;
vx=x1-x2;
vy=y1-y2;
len=sqrt((vx*vx)+(vy*vy));
x3=vx/((len*size)+x1);
y3=vy/((len*size)+y1);
float temp1,temp2,angle;
temp1=y3-y1;
temp2=x3-x1;
angle=atan2(temp1,temp2)+1.57;
return 0;
}

Iniciar sesión para comentar.

Respuestas (2)

Wayne King
Wayne King el 29 de Mzo. de 2013
You can either simply rewrite the algorithm in MATLAB, or create a MEX file and call the C code from MATLAB.

Sami ullah
Sami ullah el 23 de Abr. de 2020
void standard_3D_binomial (double *value, double S1, double S2, double S3, double X, double sigma1, double sigma2, double sigma3, double rho_12, double rho_13, double rho_23, double T, double r, Integer put, Integer M, Integer opt_type, Integer is_american, Integer *iflag)
double discount, t1, dt, d1, d2, d3, u1, u2, u3;
Integer i, j, k, m1, n, iflagx, jj, ind;
double zero¼0.0, hold;
double temp, ds1, ds2, dv1, dv2, h, tmp, tmp1, tmp2;
double *s1, *s2, *s3, *v;
double p[9];
Integer P1, P2, P3, tdv, tdv2;
double sqrt_dt, t, mu1, mu2, mu3, jp1, jp2, jp3;
double one ¼ 1.0, half ¼ 0.5, eighth ¼ 0.125;
Integer v1;
how to convert this code into MATLAB???
  1 comentario
James Tursa
James Tursa el 23 de Abr. de 2020
@Sami: Delete this answer. Instead, open up a new question, post your code in this new question, and describe the problems you are having.

Iniciar sesión para comentar.

Categorías

Más información sobre Programming 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