[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #46751] Blank Workspace and blank command wind
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #46751] Blank Workspace and blank command window after and during code execution |
Date: |
Wed, 23 Dec 2015 16:49:00 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36 |
URL:
<http://savannah.gnu.org/bugs/?46751>
Summary: Blank Workspace and blank command window after and
during code execution
Project: GNU Octave
Submitted by: None
Submitted on: Wed 23 Dec 2015 04:48:59 PM UTC
Category: GUI
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Assigned to: None
Originator Name: Harry Georgiou
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
Release: 4.0.0
Operating System: Microsoft Windows
_______________________________________________________
Details:
I am running a program to load every package and then I open up a user
interface to load or find the file I want to import from the code.
I load my file, after which though the command window does not load, this
could be code issues in what I have written but the other problem loading my
file and wait for it to run and get a blank screen in the command window. This
is cleared for whatever reason it is happening by pressing control C.
The program runs a bit more and I get an array list in my command window. I
then also press q to skip to the end of the program if possible. Things in the
code in theory should have been loaded and run but I have to copy and paste
them in the command line again to produce variables in the workspace.
I then notice that the workspace is blank and so I cannot be sure if anything
was run or skipped and why it would have been skipped is also confusing
because the data that may have had problems with the code I have written is
after where there apparently is a problem.
Here is part of my code while it is not needed to understand I am just showing
the code which does not seem to work: but should the workspace be blank and
the command line hang until I press Control C. At least if the code is wrong
which I am sure it is the workspace should not be empty and more values should
be there.
clc
clear all
pkg load all % this ensures all the octave packages are loaded so that i can
use the files
[FNAME, FPATH, FLTIDX] = uigetfile ('Choose an ocw or txt file solar Intensity
Sun');
addpath(FPATH); % this adds thehe paths to the working directory
Fid = fopen(FNAME);
[ListofFiles] = dir(FPATH);
skiplines = 2;
formatspec = '%f%f'; %This tells octave that I want two floating point numbers
or doubles and have an array
IVDATA = textscan (Fid, formatspec, 'HeaderLines', skiplines);
voltage = IVDATA{1,1};
current = IVDATA{1,2};
voltage = -voltage;
current = -current;
%FIRST LIGHT CURVE IF I PLOT
IT////////////////////////////////////////////////////////////////////////////////////
IVDATA = [voltage,current];
y = current;
t = voltage;
%ba=1;
%Now I want to get the Voc point for any curve so just start with an index
variable
b=1;
while y(b) < 0 %This obtains the point at which the current hits the Voc
position
b=b+1; % this will increase the value of i until current(i) or the current
is just past 0 after the first time
endwhile
Grad2Current = diff(diff(current))
BigValsFirst = sort(Grad2Current)
b2 =1;
while abs(Grad2Current(b2)) < abs(BigValsFirst(1)) %This gets the first
quarter of the whole curve even after Voc as the dataset contains two scans
with a reverse scan each
b2 = b2 +1
endwhile
Voc_index=b % just so I know what i is when I see it below
fit = polyfit(voltage(1:150),current(1:150),2)
IV10 = [current(b-100:b), voltage(b-100:b)];
k10 = diff(IV10(:,1))./diff(IV10(:,2));
AveGrad = mean(k10);
%Preparing the matrix of values
A = y(1:Voc_index);
B = -ones(Voc_index,1);
C = t(1:Voc_index);% cumtrapz(t(1:Voc_index), -B);
D = 1/2*t(1:Voc_index).^2; %cumtrapz(t(1:Voc_index), C);
Phi = [A, B, C, D];
%The other matrix
Gamma = cumtrapz(t(1:Voc_index), y(1:Voc_index));
Theta = (inverse((transpose(Phi)*Phi))*transpose(Phi))*Gamma
%The Resistanc limits
Rs_upp=(1/AveGrad)*-1%as it is a negative resistance otherwise;
Rs_low=0
%creating a set of 100 evenly spaced resistance values between the Resistance
limits
Rs = linspace(Rs_upp, Rs_low,100);
%Now the refining
a =Theta(1)
I_L= Theta(2)/Theta(1)
Io = (Theta(3) - Theta(2)/Theta(1)- Theta(1)*Theta(4))
Rsh = 1/Theta(4); %So that Resistance is positive
Initial_Vals = [a, I_L, Io, Rsh]'
q=1
n=1000;
cycle = 1;
Rs = Rs(1)
%Build up yHat
while q <=Voc_index
q
yHat(q)= I_L -(Io * ( exp( voltage(q)+ Rs * y(q) /a ) - 1) ) - ( (voltage(q)
+Rs * y(q) ) / Rsh);
q=q+1;
endwhile
%Getting the ERROR
L = 1;
%ERR=∑N i=1, [yHat(ti)−y(ti)]
while L<Voc_index
ERR_unit(L) = sum(yHat(L)-y(L));
L=L+1;
endwhile
ERR = sum(ERR_unit)
%Getting the Root mean square
Nval = 1
while Nval <=Voc_index
RMSE_prt1(Nval) = ( yHat(Nval) - y(Nval) ) .^2 ;
Nval = Nval +1;
endwhile
RMSE = sqrt( sum(RMSE_prt1) / length(RMSE_prt1) )
%ERR=∑N i=1, [yHat(ti)−y(ti)]
ERR = sum(ERR_unit)
PosERR= sqrt(ERR*ERR)
Sum_squars = sumsq(y(1:Voc_index));
Tol = 0.001 %it says 2% in the paper, but 2% of what? originally I had
Sum_squars*10*RMSE
Rs
q=1
RIndex1 = 1;
RIndex2 = 1;
while PosERR > Tol
k=1
Tol
RMSE
n =100;
ERR
cycle
if ERR > 0
%Chooseing Rs_low or Rs_upp
Rs
Rs = (Rs +Rs_low)/2;
Rs
Rs_upp=Rs
%fit = polyfit(voltage(1:150),yHat(1:150),2)
IV10 = [current(b-100:b), voltage(b-100:b)];
k10 = diff(IV10(:,1))./diff(IV10(:,2));
AveGrad = mean(k10);
%Preparing the matrix of values
A_Hat = yHat(1:Voc_index);
B = -ones(Voc_index,1);
C = t(1:Voc_index);% cumtrapz(t(1:Voc_index), -B);
D = 1/2*t(1:Voc_index).^2; %cumtrapz(t(1:Voc_index), C);
Phi_Hat = [A_Hat, B, C, D];
%The other matrix
Gamma_Hat = cumtrapz(t(1:Voc_index), yHat(1:Voc_index));
Theta_Hat =
(inverse((transpose(Phi_Hat)*Phi_Hat))*transpose(Phi_Hat))*Gamma_Hat
%The Resistanc limits
Rs_upp=(1/AveGrad)*-1%as it is a negative resistance otherwise;
Rs_low=0
%creating a set of 100 evenly spaced resistance values between the
Resistance limits
Rs = linspace(Rs_upp, Rs_low,100);
%Now the refining
a_Hat =Theta_Hat(1)
I_L_Hat = Theta_Hat(2)/Theta_Hat(1)
Io_Hat = (Theta_Hat(3) - Theta_Hat(2)/Theta_Hat(1)-
Theta_Hat(1)*Theta_Hat(4))
Rsh_Hat = 1/Theta_Hat(4); %So that Resistance is positive
Initial_Vals_Hat = [a_Hat, I_L_Hat, Io_Hat, Rsh_Hat]'
q=1
n=1000;
cycle = 1;
Rs = Rs(1)
%Build up yHat
while q <=Voc_index
q
yHat(q)= I_L_Hat -(Io_Hat * ( exp( voltage(q)+ Rs * yHat(q) /a_Hat ) - 1)
) - ( (voltage(q) +Rs * yHat(q) ) / Rsh_Hat);
q=q+1;
endwhile
while q <=Voc_index
q
yHat(q)= I_L_Hat -(Io_Hat * ( exp( voltage(q)+ Rs * yHat(q) /a_Hat ) -
1) ) - ( (voltage(q) +Rs * yHat(q) ) / Rsh_Hat);
q=q+1
endwhile
q = 1
L = 1;
%ERR=∑N i=1, [yHat(ti)−y(ti)]
Nval = 1
while Nval <=Voc_index %Getting the RMSE
RMSE_prt1(Nval) = ( yHat(Nval) - y(Nval) ) .^2 ;
Nval = Nval +1;
endwhile
RMSE = sqrt( sum(RMSE_prt1) / length(RMSE_prt1) )
while L<Voc_index %Recalculating the Error
ERR_unit(L) = sum(yHat(L)-y(L));
L=L+1;
endwhile
ERR = sum(ERR_unit)
elseif ERR < 0
Rs = (Rs+Rs_upp)/2;
Rs
Rs_low=Rs
q=1
%Getting yHat with new Rs
%fit = polyfit(voltage(1:150),yHat(1:150),2)
IV10 = [current(b-100:b), voltage(b-100:b)];
k10 = diff(IV10(:,1))./diff(IV10(:,2));
AveGrad = mean(k10);
%Preparing the matrix of values
A_Hat = yHat(1:Voc_index)';
B = -ones(Voc_index,1);
C = t(1:Voc_index);% cumtrapz(t(1:Voc_index), -B);
D = 1/2*t(1:Voc_index).^2; %cumtrapz(t(1:Voc_index), C);
Phi_Hat = [A_Hat, B, C, D];
%The other matrix
Gamma_Hat = cumtrapz(t(1:Voc_index), yHat(1:Voc_index)');
Theta_Hat =
(inverse((transpose(Phi_Hat)*Phi_Hat))*transpose(Phi_Hat))*Gamma_Hat
%The Resistanc limits
Rs_upp=(1/AveGrad)*-1%as it is a negative resistance otherwise;
Rs_low=0
%creating a set of 100 evenly spaced resistance values between the
Resistance limits
Rs = linspace(Rs_upp, Rs_low,100);
%Now the refining
a_Hat =Theta_Hat(1)
I_L_Hat = Theta_Hat(2)/Theta_Hat(1)
Io_Hat = (Theta_Hat(3) - Theta_Hat(2)/Theta_Hat(1)-
Theta_Hat(1)*Theta_Hat(4))
Rsh_Hat = 1/Theta_Hat(4); %So that Resistance is positive
Initial_Vals_Hat = [a_Hat, I_L_Hat, Io_Hat, Rsh_Hat]'
q=1
n=1000;
cycle = 1;
Rs = Rs(1)
%Build up yHat
while q <=Voc_index
q
yHat(q)= I_L_Hat -(Io_Hat * ( exp( voltage(q)+ Rs * yHat(q) /a_Hat ) - 1)
) - ( (voltage(q) +Rs * yHat(q) ) / Rsh_Hat);
q=q+1;
endwhile
while q <=Voc_index
q
yHat(q)= I_L_Hat -(Io_Hat * ( exp( voltage(q)+ Rs * yHat(q) /a_Hat ) -
1) ) - ( (voltage(q) +Rs * yHat(q) ) / Rsh_Hat);
q=q+1
endwhile
q = 1
L = 1;
while q <=Voc_index
yHat(q)= I_L -(Io * ( exp( voltage(q)+ Rs * y(q) /a ) - 1) ) - (
(voltage(q) +Rs * y(q) ) / Rsh);
q=q+1
endwhile
L = 1;
%ERR=∑N i=1, [yHat(ti)−y(ti)]
Nval = 1
while Nval <=Voc_index %Getting the RMSE
RMSE_prt1(Nval) = ( yHat(Nval) - y(Nval) ) .^2 ;
Nval = Nval +1;
endwhile
RMSE = sqrt( sum(RMSE_prt1) / length(RMSE_prt1) )
while L<Voc_index %Recalculating the Error
ERR_unit(L) = sum(yHat(L)-y(L));
L=L+1;
endwhile
ERR = sum(ERR_unit)
Rs
cycle = cycle+1
endif
endwhile
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?46751>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #46751] Blank Workspace and blank command window after and during code execution,
anonymous <=