Using vpasolve to solve equation for all values in matrix
17 views (last 30 days)
Show older comments
Maria on 4 Jun 2018
Commented: Maria on 5 Jun 2018
Is it possible to use vpasolve to solve a particular equation for all values in a matrix without looping? i have a large number of matrices and looping through them all will be very slow.
% Minimal working example
This is a miniature version of what i am doing. my matrix has 4 dimensions and are quite large.
Walter Roberson on 4 Jun 2018
No, vpasolve() will always consider matrix inputs as being equations to be solved simultaneously.
If you switch to symbolic curr_pix then you can solve() the equation, getting
ttsol = -5./ln(-(-5+curr_pix*cosd(14))./(-curr_pix*cosd(14)+5*sind(14)))
after which you can fin_mat = subs(ttsol, curr_pix, h) to get a matrix of solutions that skips the reshapes()
More Answers (0)
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!