Trouble converting Syms for plotting - Plots not accepting values as input
Afficher commentaires plus anciens
Hi,
I have a model which uses a number (50-100) of syms, the syms are used to form equations (different models).
The syms are then converted in to values (doubles) and the equations plotted.
To convert the syms to values I have tried subs(), vpa(), and a few other forum solutions, and I think this is where the issue lies, however I am unable to use the converted values as inputs in plot functions (plot(), surf(), etc...).
Below is a short version of code which generates the problem, The resulting command window error is also included.
Thanks for any assistance
%*******CODE********
clear;
close all;
clc;
%Generate Symbol
syms POS;
%Convert Symbol to value
POS = 5;
POS = subs(POS);
%Variable for Plotting
A = POS
B = 5;
C = 10;
[x,y,z] = sphere(50);
%Plot Function
figure;
surf(x+A, y+B, z+C);
%*******Command Window********
>> test2
A = 5
Error using surf (line 57)
Invalid parameter/value pair arguments.
Error in test2 (line 11)
surf(x+A, y+B, z+C);
*Note; A is a 1x1 sym in the workspace
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Operations on Strings dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!