Table shows 1x1 sym
Ältere Kommentare anzeigen
Hi every body,
I have a simple function to solve an equation using some date from a table:
function [s] = angle(r2,a2)
syms a1
x=a2*pi/180;
s=(vpasolve(sin(pi-a1)==(r2/0.8)*sin(a1-x),a1))*180/3.14
end
Command Window:
>> r2=[3.89;3.90;3.91]
r2 =
3.8900
3.9000
3.9100
>> a2=[8.87;8.86;8.83]
a2 =
8.8700
8.8600
8.8300
>> param=table(r2,a2)
param =
3×2 table
r2 a2
____ ____
3.89 8.87
3.9 8.86
3.91 8.83
>> stats = rowfun(@angle,param,'OutputVariableNames', {'simulatedMean' })
s =
11.154670370349323645591725425313
s =
11.134816655884783149835261112257
s =
11.089983811612564656965216573319
stats =
3×1 table
simulatedMean
_____________
[1×1 sym]
[1×1 sym]
[1×1 sym]
Every thing is o.k but I have the answers in the table stats in form of 1x1 sym. They should be the values of s= 11.15 , 11.13 , 11.08
Could you please help me. I really appreciate that.
Antworten (1)
VBBV
am 14 Mär. 2022
function s = angle(r2,a2)
Change the return value in function to s
5 Kommentare
Navid karimi
am 14 Mär. 2022
r2=[3.89;3.90;3.91]
a2=[8.87;8.86;8.83]
param=table(r2,a2)
stats = rowfun(@angle,param,'OutputVariableNames', {'simulatedMean'})
function [s] = angle(r2,a2)
syms a1
x=a2*pi/180;
s=(vpasolve(sin(pi-a1)==(r2/0.8)*sin(a1-x),a1))*180/3.14
end
Navid karimi
am 15 Mär. 2022
Torsten
am 15 Mär. 2022
If you add the line
s = double(s)
in function "angle", what do you get ?
Navid karimi
am 15 Mär. 2022
Bearbeitet: Navid karimi
am 15 Mär. 2022
Kategorien
Mehr zu Conversion Between Symbolic and Numeric finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!