'Syms' in Simulink implementation (Symbolic variables)

2 Ansichten (letzte 30 Tage)
Lenin Cruz
Lenin Cruz am 28 Aug. 2019
Kommentiert: Niraj Reginald am 18 Nov. 2019
Hello,
I am working with the Matlab function block in Simulink where I give it 6 inputs and I am trying to get 2 outputs.
The problem comes when using 'syms' for symbolic variables. I get the error Function 'syms' not supported for code generation. When running my simulink model.
Below is an example of the matlab script that I'm trying to integrate to simulink. The code is really simple it is just trying to solve two circunference equatios for 'x' and 'y' using the inputs provided to the simulink block
function [X,Y]= fcn(Data1, Data2, Data3, Data4, Data5, Data6)
syms x y
vars = [x y];
h1=Data1;
k1=Data2;
r1=Data3;
h2=Data4;
k2=Data5;
r2=Data6;
eqns = [(x-h1).^2 + (y-k1).^2 == r1,... % circumference equation 1
(x-h2).^2 + (y-k2).^2 == r2]; % circumference equation 2
[solx, soly] = solve(eqns, vars);
X= solx;
Y= soly;
end
Is there a way of implementing 'syms' in simulink or any other alternative? I have read something about the coder.extrinsic function for matlab but I am not sure about how to use it as I have a different number of outputs and inputs.
  1 Kommentar
Niraj Reginald
Niraj Reginald am 18 Nov. 2019
Hi Lenin,
Were you able to solve this? I am facing the same issue?
Thank you,
Niraj

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by