Hi – I need to find the solutions of several implicit equations, then save the positive roots in a matrix (possibly a "double" array).
When I try to do so I get an error, "Assignment has more non-singleton rhs dimensions than non-singleton subscripts".
I'd greatly appreciate some help. Here's a simplified version of my code.
Notes:
- I understand that using "solve" like I'm doing here below will return 2 solutions for each equation. I tried using vpasolve instead, specifying an interval, but I still get the same error message;
- I need to do this for different equations and some functional forms make it impossible to find the solutions explicitly, hence my need for a general procedure
clear all; close all; clc;GAMMA =1.1;ALOW=0.6;data=[0 0 7.34 9.39 0 9.12 7.95 8.06 8.47 9.16;8.26 0 0 0 7.5 0 7.82 7.24 9.54 9.13;0 8.31 8.99 9.46 0 0 0 8.16 7.85 7.23;7.96 0 7.53 8.47 0 8.62 0 0 7.31 7.13;8.83 8.72 8.65 9.42 0 8.87 7.86 0 8.34 8.89;0 7.79 0 8.27 9.45 7.15 0 8.19 0 0;0 0 9.34 7.08 8.72 0 0 0 0 0;7.59 0 7.53 7.48 7.78 0 8.86 0 7.74 8.95;7.37 0 8.07 0 7.64 0 8.9 9.27 9.15 7.89;0 7.09 8.34 8.55 9.33 8.89 0 0 6.96 8.95]; output=zeros(10,10);for j = 1 : 10 for t=1:10 if data(t,j) >0 syms x output(t,j)=solve(ALOW*(1/(x^2+1)^(3/2))*GAMMA*data(t, j)-1, x); else output(t,j)=0; end endend
Best Answer