Hello,(adsbygoogle = window.adsbygoogle || []).push({});

My work is on numerical techniques which require to solve sparse matrices etc. All my work is in fortran and I have almost no skill in Matlab.But I have just realized that Matlab can do some computations quite easily with its built-in functions and I want to take advantage of this. I have no time to learn Matlab deeply or work on matlab-fortran communication (very much off-focus issues and have deadline soon)

Some details:

I need to solve Ax=b system where A is very large and sparse matrix (20000x20000 or more). At every time step (iteration) I need to solve this system, get 'x' and reuse it for further computation in that step. [A] is fixed and formed before the iteration begins - but vector 'b' changes at every iteration. So in the iteration -- i) vector 'b' is formed, ii) solve Ax=b to find 'x' iii) use many other (explicit algebraic) equations to calculate some other values / fields (magnetic fields) iv) save field values for that step and move to the next step. Then these steps are repeated once and again. I am doing steps i), iii), iv) in fortran and want to do step ii) in matlab. Actually I have the whole code written in fortran but want to do some analysis by just doing the step ii) in Matlab. Can you please advise me if that is possible and if, how can I do that?

I have tried Matlab to solve Ax=b just for a single iteration. That means, I could read matrix [A], an instance of vector 'b' in matlab (after saving them in files from fortran). Then I solved them in Matlab command window using 'bicgstab' command (also used 'luinc' preconditioner etc, did some matrix blocking etc). But I need to repeatedly do this for the whole system and also calculate 'b' vector in fortran using the obtained solution. Can you please advise me on this. Thank you so much.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Using Matlab functions in Fortran - need help

Loading...

Similar Threads - Using Matlab functions | Date |
---|---|

Using MATLAB outside of the lab | Jan 4, 2018 |

Optimization using genetic algorithm in matlab | May 8, 2014 |

Calculate amplitude, phase and energy spectrum using FFT in MATLAB | Jul 17, 2012 |

3-D plot using 3 vectors in Matlab | Jul 16, 2012 |

Eigenvalues using matlab | Apr 25, 2012 |

**Physics Forums - The Fusion of Science and Community**