How can I convert a equation into an character array?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Emre Sahin
el 17 de Oct. de 2018
Editada: Emre Sahin
el 20 de Oct. de 2018
Hi community,
I want to convert an equation like: N=1-X into an character array like: Z='N=1-X' or the other way around. The problem is functions like string2num() do not accept variables as input.
4 comentarios
Guillaume
el 19 de Oct. de 2018
Again, as Matt asked, what form does the equation takes in your code? There are many ways to code an equation for plotting and the answer is going to depend on how you've done it.
Respuesta aceptada
Matt J
el 19 de Oct. de 2018
Editada: Matt J
el 19 de Oct. de 2018
methods(Static) function surfplot(handles,X,Y,fun) %<---change s=surf(X,Y,fun(X,Y)); s.FaceColor='interp'; a=gca; a.Box='on'; zlim([0 1]); xlabel('x') ylabel('y') % I want to display the function instead of N %
N=strrep( func2str(fun) ,'@(x,y)','' ); %<---change zlabel( N ) % I want to show the function N on the static text field% set(handles.text,'string', N) end
function Node1plot(handles,X,Y)
fun=@(x,y) 1/4*(1-x).*(1-y); %<---change
figure('Name','Plot Formfunctions: Node1plot',... 'NumberTitle','off', 'Units', 'Normalized', ... 'OuterPosition', [0.5 0 0.5 1]); colormap(jet) Formfunktionen.surfplot(handles,X,Y,fun) %<---change end
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Axis Labels en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!