Symbols instead of line with plot

2 visualizaciones (últimos 30 días)
cris sanchez
cris sanchez el 3 de Jul. de 2020
Comentada: Walter Roberson el 3 de Jul. de 2020
Hi, wanted to know why appears some symbols instead of the line with plot.
This is what I get:
And this is some part of the code:
function temp_Callback(hObject, eventdata, handles)
global s;
% hObject handle to temp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
T = get(hObject, 'Value'); %get value from slider
set(handles.text15, 'String', T); %Set the slider's value to the static text
[k,Cp]=proptermicas(T,s); %k y cp are calculated sending as parameters the slider value and the substance
set(handles.edit8, 'String', k); %Set the k to the edit box
set(handles.edit7, 'String', Cp); %Set Cp to the last edit box
cla()
T_ = linspace(-50,400,20); %Declare a new variable with the slider range -50 to 400
for i = 1:20 %for i to linespace 20
[k,Cp]=proptermicas(T_(i),s); %call to the function
k_ = k;
Cp_ = Cp;
end
yyaxis left
cla
plot(T_,k_)
hold on
plot(T,k,'kx', 'LineWidth',2)
yyaxis right
plot(T_,Cp_)
hold on
plot(T,Cp,'kx', 'LineWidth',2)
  1 comentario
Walter Roberson
Walter Roberson el 3 de Jul. de 2020
I predict that proptermicas is returning a character such as '^' rather than numbers.

Iniciar sesión para comentar.

Respuestas (1)

the cyclist
the cyclist el 3 de Jul. de 2020
It looks like it might be because
k_
is only a single value, the last one of the loop. Maybe you wanted
k_(i) = k;
in the loop?
  1 comentario
Walter Roberson
Walter Roberson el 3 de Jul. de 2020
Oh, could be... the change in symbols might be due to the "hold on", which I did not pay attention to when I commented.

Iniciar sesión para comentar.

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by