Symbols instead of line with plot

3 Ansichten (letzte 30 Tage)
cris sanchez
cris sanchez am 3 Jul. 2020
Kommentiert: Walter Roberson am 3 Jul. 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 Kommentar
Walter Roberson
Walter Roberson am 3 Jul. 2020
I predict that proptermicas is returning a character such as '^' rather than numbers.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

the cyclist
the cyclist am 3 Jul. 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 Kommentar
Walter Roberson
Walter Roberson am 3 Jul. 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.

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by