Category: Matlab
Category Archives: Matlab
The TCP/IP function of Simulink
I’ve create a tcp/ip connection between the ‘.m’ file and Simulink. When I use ‘sine wave’ to send data though ‘TCP/IP Client Send’, it can get though successfully. However, when I use ‘clock’ to send data though ‘TCP/IP Client Send’, the it is wrong.I’ve create a tcp/ip connection between the ‘.m’ file and Simulink. When I use ‘sine wave’ to send data though ‘TCP/IP Client Send’, it can get though successfully. However, when I use ‘clock’ to send data though ‘TCP/IP Client Send’, the it is wrong. I’ve create a tcp/ip connection between the ‘.m’ file and Simulink. When I use ‘sine wave’ to send data though ‘TCP/IP Client Send’, it can get though successfully. However, when I use ‘clock’ to send data though ‘TCP/IP Client Send’, the it is wrong. tcp/ip client MATLAB Answers — New Questions
Simulink WebView export from R2014 not displayable in Chrome?
WebViews exported from R2013B work fine in Chrome for me. WebViews exported from R2014 display a blank screen. Using the debugging console, I see a javascript error:
Uncaught Error: declare: base class is not a callable constructor. webview.js:558
This is not the well-known local file reference problem (obviously, or the webview.js file would not have been loaded). The same exported WebView displays properly in Firefox and IE11. I need this to work in Chrome, as I have a project where the WebView is supposed to be displayed from inside an application using Chromium Embedded Framework. (I’m seeing the same behavior in the normal Desktop Chrome app and in CEF3). Any ideas what is wrong?
Thanks!WebViews exported from R2013B work fine in Chrome for me. WebViews exported from R2014 display a blank screen. Using the debugging console, I see a javascript error:
Uncaught Error: declare: base class is not a callable constructor. webview.js:558
This is not the well-known local file reference problem (obviously, or the webview.js file would not have been loaded). The same exported WebView displays properly in Firefox and IE11. I need this to work in Chrome, as I have a project where the WebView is supposed to be displayed from inside an application using Chromium Embedded Framework. (I’m seeing the same behavior in the normal Desktop Chrome app and in CEF3). Any ideas what is wrong?
Thanks! WebViews exported from R2013B work fine in Chrome for me. WebViews exported from R2014 display a blank screen. Using the debugging console, I see a javascript error:
Uncaught Error: declare: base class is not a callable constructor. webview.js:558
This is not the well-known local file reference problem (obviously, or the webview.js file would not have been loaded). The same exported WebView displays properly in Firefox and IE11. I need this to work in Chrome, as I have a project where the WebView is supposed to be displayed from inside an application using Chromium Embedded Framework. (I’m seeing the same behavior in the normal Desktop Chrome app and in CEF3). Any ideas what is wrong?
Thanks! simulink, webview, chrome MATLAB Answers — New Questions
Calling Matlab Function with Multiple Returns in C++ Semantic Error
Hello, I am running into a type error where I am not able to recieve multiple returns from a custom matlab function that gives multiple returns. Here is the C++ implementation, function and error message which is defined by the IDE as a semantic issue.
C++ CALL:
matlab::data::TypedArray<double> const errArray =
factory.createArray({1,10}, {-5.6355,-5.6188,-5.6022,-5.5856,-5.569,-5.5524,-5.5358,-5.5193,-5.5027,-5.4862});
std::vector<matlab::data::Array> args({errArray});
std::vector<matlab::data::Array> m_results = matlabPtr->feval(u"func",args);
MATLAB FUNCTION:
function [cnt,rng,mn,adq,des] = func(errArr)
matrix = rainflow(errArr);
cnt = matrix(:,1);
rng = matrix(:,2);
mn = matrix(:,3);
adq = 1;
des = 1;
end
ERROR MESSAGE (SEMANTIC ISSUE):
MatlabCall.cpp:80:38: No viable conversion from ‘matlab::data::Array’ to ‘std::vector<matlab::data::Array>’
stl_vector.h:553:7: candidate constructor not viable: no known conversion from ‘matlab::data::Array’ to ‘const vector<Array> &’ for 1st argument
stl_vector.h:572:7: candidate constructor not viable: no known conversion from ‘matlab::data::Array’ to ‘vector<Array> &&’ for 1st argument
stl_vector.h:625:7: candidate constructor not viable: no known conversion from ‘matlab::data::Array’ to ‘initializer_list<value_type>’ (aka ‘initializer_list<matlab::data::Array>’) for 1st argument
stl_vector.h:497:7: explicit constructor is not a candidate
stl_vector.h:510:7: explicit constructor is not a candidate
I am wondering why the data type for m_results is matlab::data::array despite it being defined as a std::vector<matlab::data::Array>. The matlab engine is properly implemented and can run the multi-return example as provided here, https://www.mathworks.com/help/matlab/matlab_external/call-matlab-functions-from-c-1.html#mw_f777193c-c848-49fc-9591-bbb56a40a454, it just is seeming to have issue with my custom function.
I have tried the following:
give errArray as the feval argument (produces same error message)
define a size_t numReturned constant as shown in the documentation example (too many arguments error)
Thank you in advance.Hello, I am running into a type error where I am not able to recieve multiple returns from a custom matlab function that gives multiple returns. Here is the C++ implementation, function and error message which is defined by the IDE as a semantic issue.
C++ CALL:
matlab::data::TypedArray<double> const errArray =
factory.createArray({1,10}, {-5.6355,-5.6188,-5.6022,-5.5856,-5.569,-5.5524,-5.5358,-5.5193,-5.5027,-5.4862});
std::vector<matlab::data::Array> args({errArray});
std::vector<matlab::data::Array> m_results = matlabPtr->feval(u"func",args);
MATLAB FUNCTION:
function [cnt,rng,mn,adq,des] = func(errArr)
matrix = rainflow(errArr);
cnt = matrix(:,1);
rng = matrix(:,2);
mn = matrix(:,3);
adq = 1;
des = 1;
end
ERROR MESSAGE (SEMANTIC ISSUE):
MatlabCall.cpp:80:38: No viable conversion from ‘matlab::data::Array’ to ‘std::vector<matlab::data::Array>’
stl_vector.h:553:7: candidate constructor not viable: no known conversion from ‘matlab::data::Array’ to ‘const vector<Array> &’ for 1st argument
stl_vector.h:572:7: candidate constructor not viable: no known conversion from ‘matlab::data::Array’ to ‘vector<Array> &&’ for 1st argument
stl_vector.h:625:7: candidate constructor not viable: no known conversion from ‘matlab::data::Array’ to ‘initializer_list<value_type>’ (aka ‘initializer_list<matlab::data::Array>’) for 1st argument
stl_vector.h:497:7: explicit constructor is not a candidate
stl_vector.h:510:7: explicit constructor is not a candidate
I am wondering why the data type for m_results is matlab::data::array despite it being defined as a std::vector<matlab::data::Array>. The matlab engine is properly implemented and can run the multi-return example as provided here, https://www.mathworks.com/help/matlab/matlab_external/call-matlab-functions-from-c-1.html#mw_f777193c-c848-49fc-9591-bbb56a40a454, it just is seeming to have issue with my custom function.
I have tried the following:
give errArray as the feval argument (produces same error message)
define a size_t numReturned constant as shown in the documentation example (too many arguments error)
Thank you in advance. Hello, I am running into a type error where I am not able to recieve multiple returns from a custom matlab function that gives multiple returns. Here is the C++ implementation, function and error message which is defined by the IDE as a semantic issue.
C++ CALL:
matlab::data::TypedArray<double> const errArray =
factory.createArray({1,10}, {-5.6355,-5.6188,-5.6022,-5.5856,-5.569,-5.5524,-5.5358,-5.5193,-5.5027,-5.4862});
std::vector<matlab::data::Array> args({errArray});
std::vector<matlab::data::Array> m_results = matlabPtr->feval(u"func",args);
MATLAB FUNCTION:
function [cnt,rng,mn,adq,des] = func(errArr)
matrix = rainflow(errArr);
cnt = matrix(:,1);
rng = matrix(:,2);
mn = matrix(:,3);
adq = 1;
des = 1;
end
ERROR MESSAGE (SEMANTIC ISSUE):
MatlabCall.cpp:80:38: No viable conversion from ‘matlab::data::Array’ to ‘std::vector<matlab::data::Array>’
stl_vector.h:553:7: candidate constructor not viable: no known conversion from ‘matlab::data::Array’ to ‘const vector<Array> &’ for 1st argument
stl_vector.h:572:7: candidate constructor not viable: no known conversion from ‘matlab::data::Array’ to ‘vector<Array> &&’ for 1st argument
stl_vector.h:625:7: candidate constructor not viable: no known conversion from ‘matlab::data::Array’ to ‘initializer_list<value_type>’ (aka ‘initializer_list<matlab::data::Array>’) for 1st argument
stl_vector.h:497:7: explicit constructor is not a candidate
stl_vector.h:510:7: explicit constructor is not a candidate
I am wondering why the data type for m_results is matlab::data::array despite it being defined as a std::vector<matlab::data::Array>. The matlab engine is properly implemented and can run the multi-return example as provided here, https://www.mathworks.com/help/matlab/matlab_external/call-matlab-functions-from-c-1.html#mw_f777193c-c848-49fc-9591-bbb56a40a454, it just is seeming to have issue with my custom function.
I have tried the following:
give errArray as the feval argument (produces same error message)
define a size_t numReturned constant as shown in the documentation example (too many arguments error)
Thank you in advance. c++, matlab engine, function, matlab engine api MATLAB Answers — New Questions
Simulink Library Browser Icons
Some icons in the Simulink Object Browser are not the correct icons. When the incorrect icon is dragged into a new model window it changes into the correct icon. Specifically the buffer icon in DSP System Toolbox>System Management>Buffers. The icon in the library window shows an icon containing the text ‘-40 db’ but when it is dragged into a new model window it changes into a buffer icon.Some icons in the Simulink Object Browser are not the correct icons. When the incorrect icon is dragged into a new model window it changes into the correct icon. Specifically the buffer icon in DSP System Toolbox>System Management>Buffers. The icon in the library window shows an icon containing the text ‘-40 db’ but when it is dragged into a new model window it changes into a buffer icon. Some icons in the Simulink Object Browser are not the correct icons. When the incorrect icon is dragged into a new model window it changes into the correct icon. Specifically the buffer icon in DSP System Toolbox>System Management>Buffers. The icon in the library window shows an icon containing the text ‘-40 db’ but when it is dragged into a new model window it changes into a buffer icon. simulink MATLAB Answers — New Questions
How to configure Upload data button in App design
Designinh an App i had drag a button i want confure this button to upload raw dataDesigninh an App i had drag a button i want confure this button to upload raw data Designinh an App i had drag a button i want confure this button to upload raw data appdesigner MATLAB Answers — New Questions
How can I save data from for loop?
Hello.
I have 3 arrays of scalar number. I want to have some simple calculation on all numbers of these 3 arrays one by one (Permutation of all arrays numbers ), then multiplying every result (y) with rand(4,20) and finally saving every result as a excel data. I wrote the below codes but I have some problem: "I see in the output only the last multipication result of y" and therefore just last w.
clc
clear all
i=0;
j=1;
n=1;
A = [10 20 30 40 50 10];
B = [1 1.2 1.4 1.6 1.8 1];
C = [5 25 45 65 85 5];
z= rand(4,20);
for a = 1:125
i=i+1;
if i==6
j=j+1;
i=1;
end
if j==6
n=n+1;
j=1;
end
if(n==6)
n=1;
break ;
end
A_2 = A(i);
B_2 = B(j);
C_2 = C(n);
y = A_2 * B_2 * C_2 – A_2 * C_2;
w = y * z;
endHello.
I have 3 arrays of scalar number. I want to have some simple calculation on all numbers of these 3 arrays one by one (Permutation of all arrays numbers ), then multiplying every result (y) with rand(4,20) and finally saving every result as a excel data. I wrote the below codes but I have some problem: "I see in the output only the last multipication result of y" and therefore just last w.
clc
clear all
i=0;
j=1;
n=1;
A = [10 20 30 40 50 10];
B = [1 1.2 1.4 1.6 1.8 1];
C = [5 25 45 65 85 5];
z= rand(4,20);
for a = 1:125
i=i+1;
if i==6
j=j+1;
i=1;
end
if j==6
n=n+1;
j=1;
end
if(n==6)
n=1;
break ;
end
A_2 = A(i);
B_2 = B(j);
C_2 = C(n);
y = A_2 * B_2 * C_2 – A_2 * C_2;
w = y * z;
end Hello.
I have 3 arrays of scalar number. I want to have some simple calculation on all numbers of these 3 arrays one by one (Permutation of all arrays numbers ), then multiplying every result (y) with rand(4,20) and finally saving every result as a excel data. I wrote the below codes but I have some problem: "I see in the output only the last multipication result of y" and therefore just last w.
clc
clear all
i=0;
j=1;
n=1;
A = [10 20 30 40 50 10];
B = [1 1.2 1.4 1.6 1.8 1];
C = [5 25 45 65 85 5];
z= rand(4,20);
for a = 1:125
i=i+1;
if i==6
j=j+1;
i=1;
end
if j==6
n=n+1;
j=1;
end
if(n==6)
n=1;
break ;
end
A_2 = A(i);
B_2 = B(j);
C_2 = C(n);
y = A_2 * B_2 * C_2 – A_2 * C_2;
w = y * z;
end for loop, excel MATLAB Answers — New Questions
Reading and re-writing a Dicom file (header) with private tags
I have an RT ION dicom plan file which has a big nested header file with a lot of private tags.
I have opened the header file and processed everything I need to process and want to write it back into an updated DICOM RT plan file.
The plan file writes back. However, all the private or unknown tags that are not in the DICOM dictionary (dicom-dict.txt file) get read and re-written with a Private_ prefix e.g. Private_0300_0309 and the values under these tags is usually garbled.
Things I’ve tried so far:
I just let the private tags stay in as they are but then my re-written file has trouble being read again by the planning system I want to re-send, so that’s a no go.
I have all the information about the type of these DICOM tags (VR, VM, etc) and I have added a few of them to the dicom-dict.txt file but it makes no difference, and they still get read as private_ tags and get re-written as private tags.
I have tried using the ‘wiriteprivate’ modifier with dicomwrite but it doesn’t help because the tags are probably still showing up as private tags.
(dicomwrite([], FNnew, DICinfo, ‘CreateMode’, ‘copy’ , ‘WritePrivate’, true)
Is there any way to manually change the name of the tag/variable and assign the correct values or something? I can read the garbled values under these private tags using the char function on the transpose of the value. eg. char(variable’) but there’s not much I can do with that information unless I can re-write the name of the variable/tag and remove the private_ prefix of the tag name.
Or is there something I’m missing with teh dicom-dict.txt file? Do I need to force matlab to refresh or read it, or check if my additional tags in the dicom-dict.txt file have been read and accepted properly?
I’ve already spent a lot of time looking for a solution and I feel like a solution is right around the corner but I can’t figure it out.
Any help would be greatly appreciated.I have an RT ION dicom plan file which has a big nested header file with a lot of private tags.
I have opened the header file and processed everything I need to process and want to write it back into an updated DICOM RT plan file.
The plan file writes back. However, all the private or unknown tags that are not in the DICOM dictionary (dicom-dict.txt file) get read and re-written with a Private_ prefix e.g. Private_0300_0309 and the values under these tags is usually garbled.
Things I’ve tried so far:
I just let the private tags stay in as they are but then my re-written file has trouble being read again by the planning system I want to re-send, so that’s a no go.
I have all the information about the type of these DICOM tags (VR, VM, etc) and I have added a few of them to the dicom-dict.txt file but it makes no difference, and they still get read as private_ tags and get re-written as private tags.
I have tried using the ‘wiriteprivate’ modifier with dicomwrite but it doesn’t help because the tags are probably still showing up as private tags.
(dicomwrite([], FNnew, DICinfo, ‘CreateMode’, ‘copy’ , ‘WritePrivate’, true)
Is there any way to manually change the name of the tag/variable and assign the correct values or something? I can read the garbled values under these private tags using the char function on the transpose of the value. eg. char(variable’) but there’s not much I can do with that information unless I can re-write the name of the variable/tag and remove the private_ prefix of the tag name.
Or is there something I’m missing with teh dicom-dict.txt file? Do I need to force matlab to refresh or read it, or check if my additional tags in the dicom-dict.txt file have been read and accepted properly?
I’ve already spent a lot of time looking for a solution and I feel like a solution is right around the corner but I can’t figure it out.
Any help would be greatly appreciated. I have an RT ION dicom plan file which has a big nested header file with a lot of private tags.
I have opened the header file and processed everything I need to process and want to write it back into an updated DICOM RT plan file.
The plan file writes back. However, all the private or unknown tags that are not in the DICOM dictionary (dicom-dict.txt file) get read and re-written with a Private_ prefix e.g. Private_0300_0309 and the values under these tags is usually garbled.
Things I’ve tried so far:
I just let the private tags stay in as they are but then my re-written file has trouble being read again by the planning system I want to re-send, so that’s a no go.
I have all the information about the type of these DICOM tags (VR, VM, etc) and I have added a few of them to the dicom-dict.txt file but it makes no difference, and they still get read as private_ tags and get re-written as private tags.
I have tried using the ‘wiriteprivate’ modifier with dicomwrite but it doesn’t help because the tags are probably still showing up as private tags.
(dicomwrite([], FNnew, DICinfo, ‘CreateMode’, ‘copy’ , ‘WritePrivate’, true)
Is there any way to manually change the name of the tag/variable and assign the correct values or something? I can read the garbled values under these private tags using the char function on the transpose of the value. eg. char(variable’) but there’s not much I can do with that information unless I can re-write the name of the variable/tag and remove the private_ prefix of the tag name.
Or is there something I’m missing with teh dicom-dict.txt file? Do I need to force matlab to refresh or read it, or check if my additional tags in the dicom-dict.txt file have been read and accepted properly?
I’ve already spent a lot of time looking for a solution and I feel like a solution is right around the corner but I can’t figure it out.
Any help would be greatly appreciated. dicom, dicomwrite, private tags, private MATLAB Answers — New Questions
I have Backpropagation doubt
I’m trying to do neural network with 2 hidden layers and one neuron in the output layer without any toolboxes and just with matrix and vectors multiplications. To do this, I created fictional simple data as below to help me in this task:
%Data
x = 1:1000;
y1 = sind(x);
y2 = sind(x+30);
y3 = cosd(x);
y4 = cosd(x+30);
y5 = cosd(x+45);
% y6 will be the desired output data taht I would like my neural network
% try to predict
y6 = (y1 + y2 + y3 + y4 + y5);
Then, I coded as I thought to be be the right way, but my neural network can´t reach a good result, as below:
My doubt is if the result isn´t good because my implementation isn´t right or because I need to add more mechanisms im my neural network (like momentum, regularization and etc.) ?
I will post my code below sorry about the naem of some variables, but originally I wrote this code in portuguese. I will comment the code to help undestand it
%Nueral network achictecture
n_h1 = 10;
n_h2 = 11;
n_out = 1;
%Adjustable parameters
w1 = rand(5,n_h1);
b1 = ones(1,n_h1)*rand(1,1);
w2 = rand(n_h1,n_h2);
b2 = ones(1,n_h2)*rand(1,1);
w_out = rand(n_h2,n_out);
b_out = ones(1,n_out)*rand(1,1);
sig_a = 1;
learning_rate = 0.001;
limiar = 0.002;
%Helpful variables
max_epocas = 1000;
conj_entrada = [y1;y2;y3;y4;y5];
erros_epoca = [];
%Backpropagation
for epoch = 1:max_epocas
for i = 1:size(conj_entrada,2)
if i ==1
soma = 0;
else
end
enter = conj_entrada(:,i);
h1_in = [w1;b1]’*[enter;1];
h1_out = sig(h1_in,sig_a,’False’);
h2_in = [w2;b2]’*[h1_out;1];
h2_out = sig(h2_in,sig_a,’False’);
saida_in = [w_out;b_out]’*[h2_out;1];
saida_out = saida_in;
erro = y6(i) – saida_out;
soma = soma + (erro^2);
%Here starts the part of the code where the gradients are being
%calculated. Note that, here, I tried to folllow the chain rule.
%let me try to help in the understanding. Saida in portuguese is
%like output in english so when you read ,for example,
%d_erro_d_saida_out you need to know that this is the derivative of
%the error in relation with the output of the output layer. In the
%same way, entrada means input and pesos means weights
%output layer
%chain rule
d_erro_d_saida_out = -1*erro;
d_saida_d_entrada_out = 1; %linear
grad_saida = erro*d_saida_d_entrada_out;
d_entrada_d_pesos_out = h2_out;
d_erro_d_pesos_out = d_erro_d_saida_out*d_saida_d_entrada_out*d_entrada_d_pesos_out;
% Update the wights and bias
w_out = w_out -learning_rate*d_erro_d_pesos_out;
b_out = b_out -learning_rate*d_erro_d_saida_out*d_saida_d_entrada_out;
%Second hidden layer (The neighbor layer of the output layer)
%chain rule
d_erro_d_saida_h2 = -1*w_out*grad_saida;
d_saida_d_entrada_h2 = sig(h2_in,sig_a,’True’);
grad_h2 = sum(grad_saida)*d_saida_d_entrada_h2;
d_entrada_d_pesos_h2 = h1_out;
d_erro_d_pesos_h2 = d_entrada_d_pesos_h2*grad_h2′;
% Update the wights and bias
w2 = w2 -1*learning_rate*d_erro_d_pesos_h2;
b2 = b2 -1*learning_rate*sum(d_erro_d_saida_h2.*d_saida_d_entrada_h2,1);
%First hidden layer (The neighbor layer of the seccond hidden layer)
%chain rule
d_erro_d_saida_h1 = -1*w2*grad_h2;
d_saida_d_entrada_h1 = sig(h1_in,sig_a,’True’);
grad_h1 = sum(grad_h2)*d_saida_d_entrada_h1; %então daqui, tem que sair um 3×1
d_entrada_d_pesos_h1 = enter;
d_erro_d_pesos_h1 = d_entrada_d_pesos_h1*grad_h1′; %a segunda variável tem que resultar em um 1×3
% Update the wights and bias
w1 = w1 -1*learning_rate*d_erro_d_pesos_h1;
b1 = b1 -1*learning_rate*sum(d_erro_d_saida_h1.*d_saida_d_entrada_h1,1);
end
erro_atual = (soma/(2*size(x,2)));
erros_epoca = [erros_epoca;erro_atual];
if erros_epoca(epoch) <limiar
break
else
end
end
%testing the output of neural network
vetor_teste = 1:1000;
resposta_teste = zeros(1,size(vetor_teste,2));
for i = 1:size(vetor_teste,2)
enter_teste = conj_entrada(:,i);
h1_in_teste = [w1;b1]’*[enter_teste;1];
h1_out_teste = sig(h1_in_teste,sig_a,’False’);
h2_in_teste = [w2;b2]’*[h1_out_teste;1];
h2_out_teste = sig(h2_in_teste,sig_a,’False’);
saida_in_teste = [w_out;b_out]’*[h2_out_teste;1];
saida_out_teste = saida_in_teste; % a função de saída é linear;
resposta_teste(i) = saida_out_teste;
end
plot(1:size(erros_epoca,1),erros_epoca);
% plot(x,y3,’b’,vetor_teste,resposta_teste,’r’);
The code of my sigmoid activation function is below:
function [vetor_saida] = sig(vetor_entrada, const1, derivative)
if strcmp(derivative, ‘False’) == 1
vetor_saida = 1 ./ (1 + exp(-const1 * vetor_entrada));
else
sig_value = sig(vetor_entrada, const1, ‘False’);
vetor_saida = const1 * sig_value .* (1 – sig_value);
end
endI’m trying to do neural network with 2 hidden layers and one neuron in the output layer without any toolboxes and just with matrix and vectors multiplications. To do this, I created fictional simple data as below to help me in this task:
%Data
x = 1:1000;
y1 = sind(x);
y2 = sind(x+30);
y3 = cosd(x);
y4 = cosd(x+30);
y5 = cosd(x+45);
% y6 will be the desired output data taht I would like my neural network
% try to predict
y6 = (y1 + y2 + y3 + y4 + y5);
Then, I coded as I thought to be be the right way, but my neural network can´t reach a good result, as below:
My doubt is if the result isn´t good because my implementation isn´t right or because I need to add more mechanisms im my neural network (like momentum, regularization and etc.) ?
I will post my code below sorry about the naem of some variables, but originally I wrote this code in portuguese. I will comment the code to help undestand it
%Nueral network achictecture
n_h1 = 10;
n_h2 = 11;
n_out = 1;
%Adjustable parameters
w1 = rand(5,n_h1);
b1 = ones(1,n_h1)*rand(1,1);
w2 = rand(n_h1,n_h2);
b2 = ones(1,n_h2)*rand(1,1);
w_out = rand(n_h2,n_out);
b_out = ones(1,n_out)*rand(1,1);
sig_a = 1;
learning_rate = 0.001;
limiar = 0.002;
%Helpful variables
max_epocas = 1000;
conj_entrada = [y1;y2;y3;y4;y5];
erros_epoca = [];
%Backpropagation
for epoch = 1:max_epocas
for i = 1:size(conj_entrada,2)
if i ==1
soma = 0;
else
end
enter = conj_entrada(:,i);
h1_in = [w1;b1]’*[enter;1];
h1_out = sig(h1_in,sig_a,’False’);
h2_in = [w2;b2]’*[h1_out;1];
h2_out = sig(h2_in,sig_a,’False’);
saida_in = [w_out;b_out]’*[h2_out;1];
saida_out = saida_in;
erro = y6(i) – saida_out;
soma = soma + (erro^2);
%Here starts the part of the code where the gradients are being
%calculated. Note that, here, I tried to folllow the chain rule.
%let me try to help in the understanding. Saida in portuguese is
%like output in english so when you read ,for example,
%d_erro_d_saida_out you need to know that this is the derivative of
%the error in relation with the output of the output layer. In the
%same way, entrada means input and pesos means weights
%output layer
%chain rule
d_erro_d_saida_out = -1*erro;
d_saida_d_entrada_out = 1; %linear
grad_saida = erro*d_saida_d_entrada_out;
d_entrada_d_pesos_out = h2_out;
d_erro_d_pesos_out = d_erro_d_saida_out*d_saida_d_entrada_out*d_entrada_d_pesos_out;
% Update the wights and bias
w_out = w_out -learning_rate*d_erro_d_pesos_out;
b_out = b_out -learning_rate*d_erro_d_saida_out*d_saida_d_entrada_out;
%Second hidden layer (The neighbor layer of the output layer)
%chain rule
d_erro_d_saida_h2 = -1*w_out*grad_saida;
d_saida_d_entrada_h2 = sig(h2_in,sig_a,’True’);
grad_h2 = sum(grad_saida)*d_saida_d_entrada_h2;
d_entrada_d_pesos_h2 = h1_out;
d_erro_d_pesos_h2 = d_entrada_d_pesos_h2*grad_h2′;
% Update the wights and bias
w2 = w2 -1*learning_rate*d_erro_d_pesos_h2;
b2 = b2 -1*learning_rate*sum(d_erro_d_saida_h2.*d_saida_d_entrada_h2,1);
%First hidden layer (The neighbor layer of the seccond hidden layer)
%chain rule
d_erro_d_saida_h1 = -1*w2*grad_h2;
d_saida_d_entrada_h1 = sig(h1_in,sig_a,’True’);
grad_h1 = sum(grad_h2)*d_saida_d_entrada_h1; %então daqui, tem que sair um 3×1
d_entrada_d_pesos_h1 = enter;
d_erro_d_pesos_h1 = d_entrada_d_pesos_h1*grad_h1′; %a segunda variável tem que resultar em um 1×3
% Update the wights and bias
w1 = w1 -1*learning_rate*d_erro_d_pesos_h1;
b1 = b1 -1*learning_rate*sum(d_erro_d_saida_h1.*d_saida_d_entrada_h1,1);
end
erro_atual = (soma/(2*size(x,2)));
erros_epoca = [erros_epoca;erro_atual];
if erros_epoca(epoch) <limiar
break
else
end
end
%testing the output of neural network
vetor_teste = 1:1000;
resposta_teste = zeros(1,size(vetor_teste,2));
for i = 1:size(vetor_teste,2)
enter_teste = conj_entrada(:,i);
h1_in_teste = [w1;b1]’*[enter_teste;1];
h1_out_teste = sig(h1_in_teste,sig_a,’False’);
h2_in_teste = [w2;b2]’*[h1_out_teste;1];
h2_out_teste = sig(h2_in_teste,sig_a,’False’);
saida_in_teste = [w_out;b_out]’*[h2_out_teste;1];
saida_out_teste = saida_in_teste; % a função de saída é linear;
resposta_teste(i) = saida_out_teste;
end
plot(1:size(erros_epoca,1),erros_epoca);
% plot(x,y3,’b’,vetor_teste,resposta_teste,’r’);
The code of my sigmoid activation function is below:
function [vetor_saida] = sig(vetor_entrada, const1, derivative)
if strcmp(derivative, ‘False’) == 1
vetor_saida = 1 ./ (1 + exp(-const1 * vetor_entrada));
else
sig_value = sig(vetor_entrada, const1, ‘False’);
vetor_saida = const1 * sig_value .* (1 – sig_value);
end
end I’m trying to do neural network with 2 hidden layers and one neuron in the output layer without any toolboxes and just with matrix and vectors multiplications. To do this, I created fictional simple data as below to help me in this task:
%Data
x = 1:1000;
y1 = sind(x);
y2 = sind(x+30);
y3 = cosd(x);
y4 = cosd(x+30);
y5 = cosd(x+45);
% y6 will be the desired output data taht I would like my neural network
% try to predict
y6 = (y1 + y2 + y3 + y4 + y5);
Then, I coded as I thought to be be the right way, but my neural network can´t reach a good result, as below:
My doubt is if the result isn´t good because my implementation isn´t right or because I need to add more mechanisms im my neural network (like momentum, regularization and etc.) ?
I will post my code below sorry about the naem of some variables, but originally I wrote this code in portuguese. I will comment the code to help undestand it
%Nueral network achictecture
n_h1 = 10;
n_h2 = 11;
n_out = 1;
%Adjustable parameters
w1 = rand(5,n_h1);
b1 = ones(1,n_h1)*rand(1,1);
w2 = rand(n_h1,n_h2);
b2 = ones(1,n_h2)*rand(1,1);
w_out = rand(n_h2,n_out);
b_out = ones(1,n_out)*rand(1,1);
sig_a = 1;
learning_rate = 0.001;
limiar = 0.002;
%Helpful variables
max_epocas = 1000;
conj_entrada = [y1;y2;y3;y4;y5];
erros_epoca = [];
%Backpropagation
for epoch = 1:max_epocas
for i = 1:size(conj_entrada,2)
if i ==1
soma = 0;
else
end
enter = conj_entrada(:,i);
h1_in = [w1;b1]’*[enter;1];
h1_out = sig(h1_in,sig_a,’False’);
h2_in = [w2;b2]’*[h1_out;1];
h2_out = sig(h2_in,sig_a,’False’);
saida_in = [w_out;b_out]’*[h2_out;1];
saida_out = saida_in;
erro = y6(i) – saida_out;
soma = soma + (erro^2);
%Here starts the part of the code where the gradients are being
%calculated. Note that, here, I tried to folllow the chain rule.
%let me try to help in the understanding. Saida in portuguese is
%like output in english so when you read ,for example,
%d_erro_d_saida_out you need to know that this is the derivative of
%the error in relation with the output of the output layer. In the
%same way, entrada means input and pesos means weights
%output layer
%chain rule
d_erro_d_saida_out = -1*erro;
d_saida_d_entrada_out = 1; %linear
grad_saida = erro*d_saida_d_entrada_out;
d_entrada_d_pesos_out = h2_out;
d_erro_d_pesos_out = d_erro_d_saida_out*d_saida_d_entrada_out*d_entrada_d_pesos_out;
% Update the wights and bias
w_out = w_out -learning_rate*d_erro_d_pesos_out;
b_out = b_out -learning_rate*d_erro_d_saida_out*d_saida_d_entrada_out;
%Second hidden layer (The neighbor layer of the output layer)
%chain rule
d_erro_d_saida_h2 = -1*w_out*grad_saida;
d_saida_d_entrada_h2 = sig(h2_in,sig_a,’True’);
grad_h2 = sum(grad_saida)*d_saida_d_entrada_h2;
d_entrada_d_pesos_h2 = h1_out;
d_erro_d_pesos_h2 = d_entrada_d_pesos_h2*grad_h2′;
% Update the wights and bias
w2 = w2 -1*learning_rate*d_erro_d_pesos_h2;
b2 = b2 -1*learning_rate*sum(d_erro_d_saida_h2.*d_saida_d_entrada_h2,1);
%First hidden layer (The neighbor layer of the seccond hidden layer)
%chain rule
d_erro_d_saida_h1 = -1*w2*grad_h2;
d_saida_d_entrada_h1 = sig(h1_in,sig_a,’True’);
grad_h1 = sum(grad_h2)*d_saida_d_entrada_h1; %então daqui, tem que sair um 3×1
d_entrada_d_pesos_h1 = enter;
d_erro_d_pesos_h1 = d_entrada_d_pesos_h1*grad_h1′; %a segunda variável tem que resultar em um 1×3
% Update the wights and bias
w1 = w1 -1*learning_rate*d_erro_d_pesos_h1;
b1 = b1 -1*learning_rate*sum(d_erro_d_saida_h1.*d_saida_d_entrada_h1,1);
end
erro_atual = (soma/(2*size(x,2)));
erros_epoca = [erros_epoca;erro_atual];
if erros_epoca(epoch) <limiar
break
else
end
end
%testing the output of neural network
vetor_teste = 1:1000;
resposta_teste = zeros(1,size(vetor_teste,2));
for i = 1:size(vetor_teste,2)
enter_teste = conj_entrada(:,i);
h1_in_teste = [w1;b1]’*[enter_teste;1];
h1_out_teste = sig(h1_in_teste,sig_a,’False’);
h2_in_teste = [w2;b2]’*[h1_out_teste;1];
h2_out_teste = sig(h2_in_teste,sig_a,’False’);
saida_in_teste = [w_out;b_out]’*[h2_out_teste;1];
saida_out_teste = saida_in_teste; % a função de saída é linear;
resposta_teste(i) = saida_out_teste;
end
plot(1:size(erros_epoca,1),erros_epoca);
% plot(x,y3,’b’,vetor_teste,resposta_teste,’r’);
The code of my sigmoid activation function is below:
function [vetor_saida] = sig(vetor_entrada, const1, derivative)
if strcmp(derivative, ‘False’) == 1
vetor_saida = 1 ./ (1 + exp(-const1 * vetor_entrada));
else
sig_value = sig(vetor_entrada, const1, ‘False’);
vetor_saida = const1 * sig_value .* (1 – sig_value);
end
end neural network, backpropagation MATLAB Answers — New Questions
mex_C_win64 vs mingw64
I am having trouble executing mex files. Currently my compiler configurations looks like this:
>> mex.getCompilerConfigurations(‘C’)
ans =
CompilerConfiguration with properties:
Name: ‘MinGW64 Compiler (C)’
Manufacturer: ‘GNU’
Language: ‘C’
Version: ‘6.3.0’
Location: ‘C:MinGW8mingw64’
ShortName: ‘mingw64’
Priority: ‘E’
Details: [1×1 mex.CompilerConfigurationDetails]
LinkerName: ‘C:MinGW8mingw64bingcc’
LinkerVersion: ”
MexOpt: ‘C:Users<Username deducted>AppDataRoamingMathWorksMATLABR2022bmex_C_win64.xml’
However, other people in my organization mostly have MexOpt like so:
MexOpt: ‘C:Program FilesMATLABR2022bbinwin64mexoptsmingw64.xml’
Is it possible to align with others without manually editing compiler configs, if not how can I manually fix this?I am having trouble executing mex files. Currently my compiler configurations looks like this:
>> mex.getCompilerConfigurations(‘C’)
ans =
CompilerConfiguration with properties:
Name: ‘MinGW64 Compiler (C)’
Manufacturer: ‘GNU’
Language: ‘C’
Version: ‘6.3.0’
Location: ‘C:MinGW8mingw64’
ShortName: ‘mingw64’
Priority: ‘E’
Details: [1×1 mex.CompilerConfigurationDetails]
LinkerName: ‘C:MinGW8mingw64bingcc’
LinkerVersion: ”
MexOpt: ‘C:Users<Username deducted>AppDataRoamingMathWorksMATLABR2022bmex_C_win64.xml’
However, other people in my organization mostly have MexOpt like so:
MexOpt: ‘C:Program FilesMATLABR2022bbinwin64mexoptsmingw64.xml’
Is it possible to align with others without manually editing compiler configs, if not how can I manually fix this? I am having trouble executing mex files. Currently my compiler configurations looks like this:
>> mex.getCompilerConfigurations(‘C’)
ans =
CompilerConfiguration with properties:
Name: ‘MinGW64 Compiler (C)’
Manufacturer: ‘GNU’
Language: ‘C’
Version: ‘6.3.0’
Location: ‘C:MinGW8mingw64’
ShortName: ‘mingw64’
Priority: ‘E’
Details: [1×1 mex.CompilerConfigurationDetails]
LinkerName: ‘C:MinGW8mingw64bingcc’
LinkerVersion: ”
MexOpt: ‘C:Users<Username deducted>AppDataRoamingMathWorksMATLABR2022bmex_C_win64.xml’
However, other people in my organization mostly have MexOpt like so:
MexOpt: ‘C:Program FilesMATLABR2022bbinwin64mexoptsmingw64.xml’
Is it possible to align with others without manually editing compiler configs, if not how can I manually fix this? mex, compiler MATLAB Answers — New Questions
Why do the same system matlab and simulink get different step responses?
As I asked, I want to design a fractional pid controller for a model. Unfortunately, the results I got with step in matlab are quite different from those in simulink
.
Here the orange line is the output and the blue line is the offset,Now let me show you the situation of matlab.The specific parameters of the controller are consistent with the code below
cs=fopid(9.503084707494814e+03,1.889631254823942e+02,2.304958553299564e+02,0.058440555124293,1.558103446462550);%This is parameter of controller
gs=tf(118700,[1 1085 1224000]);%This is the transfer function of the controlled object
step(feedback(cs*gs,1))%Step Response of Closed-loop Transfer Function
This is the general situation. I feel confused now.As I asked, I want to design a fractional pid controller for a model. Unfortunately, the results I got with step in matlab are quite different from those in simulink
.
Here the orange line is the output and the blue line is the offset,Now let me show you the situation of matlab.The specific parameters of the controller are consistent with the code below
cs=fopid(9.503084707494814e+03,1.889631254823942e+02,2.304958553299564e+02,0.058440555124293,1.558103446462550);%This is parameter of controller
gs=tf(118700,[1 1085 1224000]);%This is the transfer function of the controlled object
step(feedback(cs*gs,1))%Step Response of Closed-loop Transfer Function
This is the general situation. I feel confused now. As I asked, I want to design a fractional pid controller for a model. Unfortunately, the results I got with step in matlab are quite different from those in simulink
.
Here the orange line is the output and the blue line is the offset,Now let me show you the situation of matlab.The specific parameters of the controller are consistent with the code below
cs=fopid(9.503084707494814e+03,1.889631254823942e+02,2.304958553299564e+02,0.058440555124293,1.558103446462550);%This is parameter of controller
gs=tf(118700,[1 1085 1224000]);%This is the transfer function of the controlled object
step(feedback(cs*gs,1))%Step Response of Closed-loop Transfer Function
This is the general situation. I feel confused now. matlab, simulink MATLAB Answers — New Questions
Calculating number of monthly events
Hi
I have events time series. (see attached)
How I can calculate monthly number of events.
Thanks for your help!Hi
I have events time series. (see attached)
How I can calculate monthly number of events.
Thanks for your help! Hi
I have events time series. (see attached)
How I can calculate monthly number of events.
Thanks for your help! calculating number of monthly events MATLAB Answers — New Questions
roc plot
area = roc(fileName,exp)
%
% fileName: The name of the output file. It is an image
% exp: a structure representing an experiment with three fields
% – exp.name: a string specifying the experiment name
% – exp.positive_n: the number of positive samples in the experiment
% – exp.likelihoods: likelihoods of each sample where the first
% exp.positive_n number of likelihoods belongs to the positive
% samples while others belong to the negative samples.
% area: a 1×1-dimensional cell array of the area under the roc curve.
true positive,false positive values of ground truth,edge detected image was calculated…then how apply these values to roc program…??????area = roc(fileName,exp)
%
% fileName: The name of the output file. It is an image
% exp: a structure representing an experiment with three fields
% – exp.name: a string specifying the experiment name
% – exp.positive_n: the number of positive samples in the experiment
% – exp.likelihoods: likelihoods of each sample where the first
% exp.positive_n number of likelihoods belongs to the positive
% samples while others belong to the negative samples.
% area: a 1×1-dimensional cell array of the area under the roc curve.
true positive,false positive values of ground truth,edge detected image was calculated…then how apply these values to roc program…?????? area = roc(fileName,exp)
%
% fileName: The name of the output file. It is an image
% exp: a structure representing an experiment with three fields
% – exp.name: a string specifying the experiment name
% – exp.positive_n: the number of positive samples in the experiment
% – exp.likelihoods: likelihoods of each sample where the first
% exp.positive_n number of likelihoods belongs to the positive
% samples while others belong to the negative samples.
% area: a 1×1-dimensional cell array of the area under the roc curve.
true positive,false positive values of ground truth,edge detected image was calculated…then how apply these values to roc program…?????? roc MATLAB Answers — New Questions
Is there a way to model sound wave interference patterns using Phased Array System Toolbox?
I am trying to find a way to model the constructive/destructive interference patterns for sound speakers in a room, i.e. concentrating sound in a specific part of the room through creating constructive interference from several non-directional (aka regular) speakers. I have been looking at the Phased Array System Toolbox (because I am thinking about an array of speakers) and think that might be the best fit for what I am looking for. Not sure if there is another Toolbox out there that does similar things or the Phased Array System is the best fit for this? Thank you!I am trying to find a way to model the constructive/destructive interference patterns for sound speakers in a room, i.e. concentrating sound in a specific part of the room through creating constructive interference from several non-directional (aka regular) speakers. I have been looking at the Phased Array System Toolbox (because I am thinking about an array of speakers) and think that might be the best fit for what I am looking for. Not sure if there is another Toolbox out there that does similar things or the Phased Array System is the best fit for this? Thank you! I am trying to find a way to model the constructive/destructive interference patterns for sound speakers in a room, i.e. concentrating sound in a specific part of the room through creating constructive interference from several non-directional (aka regular) speakers. I have been looking at the Phased Array System Toolbox (because I am thinking about an array of speakers) and think that might be the best fit for what I am looking for. Not sure if there is another Toolbox out there that does similar things or the Phased Array System is the best fit for this? Thank you! acoustic modeling, interference patterns MATLAB Answers — New Questions
Error in installing an apps
I have a problem installing apps, the command windows gives me this:
com.mathworks.jmi.MatlabException: The specified path is invalid.
at com.mathworks.jmi.NativeMatlab.SendMatlabMessage(Native Method)
at com.mathworks.jmi.NativeMatlab.sendMatlabMessage(NativeMatlab.java:265)
at com.mathworks.jmi.MatlabLooper.sendMatlabMessage(MatlabLooper.java:120)
at com.mathworks.jmi.Matlab.mtFeval(Matlab.java:1541)
at com.mathworks.jmi.MatlabWorker.feval(MatlabWorker.java:197)
at com.mathworks.appmanagement.InstallAppMatlabWorker.doOnMatlabThread(InstallAppMatlabWorker.java:20)
at com.mathworks.appmanagement.InstallAppMatlabWorker.doOnMatlabThread(InstallAppMatlabWorker.java:7)
at com.mathworks.appmanagement.AbstractAppManagementMatlabWorker.runOnMatlabThread(AbstractAppManagementMatlabWorker.java:21)
at com.mathworks.jmi.MatlabWorker$2.run(MatlabWorker.java:79)
at com.mathworks.jmi.NativeMatlab.dispatchMTRequests(NativeMatlab.java:440)
What should I do?I have a problem installing apps, the command windows gives me this:
com.mathworks.jmi.MatlabException: The specified path is invalid.
at com.mathworks.jmi.NativeMatlab.SendMatlabMessage(Native Method)
at com.mathworks.jmi.NativeMatlab.sendMatlabMessage(NativeMatlab.java:265)
at com.mathworks.jmi.MatlabLooper.sendMatlabMessage(MatlabLooper.java:120)
at com.mathworks.jmi.Matlab.mtFeval(Matlab.java:1541)
at com.mathworks.jmi.MatlabWorker.feval(MatlabWorker.java:197)
at com.mathworks.appmanagement.InstallAppMatlabWorker.doOnMatlabThread(InstallAppMatlabWorker.java:20)
at com.mathworks.appmanagement.InstallAppMatlabWorker.doOnMatlabThread(InstallAppMatlabWorker.java:7)
at com.mathworks.appmanagement.AbstractAppManagementMatlabWorker.runOnMatlabThread(AbstractAppManagementMatlabWorker.java:21)
at com.mathworks.jmi.MatlabWorker$2.run(MatlabWorker.java:79)
at com.mathworks.jmi.NativeMatlab.dispatchMTRequests(NativeMatlab.java:440)
What should I do? I have a problem installing apps, the command windows gives me this:
com.mathworks.jmi.MatlabException: The specified path is invalid.
at com.mathworks.jmi.NativeMatlab.SendMatlabMessage(Native Method)
at com.mathworks.jmi.NativeMatlab.sendMatlabMessage(NativeMatlab.java:265)
at com.mathworks.jmi.MatlabLooper.sendMatlabMessage(MatlabLooper.java:120)
at com.mathworks.jmi.Matlab.mtFeval(Matlab.java:1541)
at com.mathworks.jmi.MatlabWorker.feval(MatlabWorker.java:197)
at com.mathworks.appmanagement.InstallAppMatlabWorker.doOnMatlabThread(InstallAppMatlabWorker.java:20)
at com.mathworks.appmanagement.InstallAppMatlabWorker.doOnMatlabThread(InstallAppMatlabWorker.java:7)
at com.mathworks.appmanagement.AbstractAppManagementMatlabWorker.runOnMatlabThread(AbstractAppManagementMatlabWorker.java:21)
at com.mathworks.jmi.MatlabWorker$2.run(MatlabWorker.java:79)
at com.mathworks.jmi.NativeMatlab.dispatchMTRequests(NativeMatlab.java:440)
What should I do? install, apps MATLAB Answers — New Questions
how to create complete binary tree in matlab of sensor nodes
iam new to matlab please help me to create complete binary tree in matlabiam new to matlab please help me to create complete binary tree in matlab iam new to matlab please help me to create complete binary tree in matlab text, node creation MATLAB Answers — New Questions
How can I add new properties to a pointcloud?
I want to add a new property to a pointcloud, which is not in the standard properties of pointcloud.
I’ve got a pointcloud with one color image, from where I extract the Color inforamtion, and one NIR image, from where I get a greyscale value for each point, and I want to have every point to have an additional Property called ‘NIR’ with this value.
I tried :
pointcloud=pointCloud(posxyz,’Intensity’,intensityvalue,’NIR’,nirvalue)
Matlab gives me the following error:
Error using pointCloud>validateAndParseInputs (line 818)
‘NIR’ is not a recognized parameter. For a list of valid name-value pair arguments, see the
documentation for this function.
Error in pointCloud (line 142)
[xyzPoints, C, nv, I] = validateAndParseInputs(varargin{:});I want to add a new property to a pointcloud, which is not in the standard properties of pointcloud.
I’ve got a pointcloud with one color image, from where I extract the Color inforamtion, and one NIR image, from where I get a greyscale value for each point, and I want to have every point to have an additional Property called ‘NIR’ with this value.
I tried :
pointcloud=pointCloud(posxyz,’Intensity’,intensityvalue,’NIR’,nirvalue)
Matlab gives me the following error:
Error using pointCloud>validateAndParseInputs (line 818)
‘NIR’ is not a recognized parameter. For a list of valid name-value pair arguments, see the
documentation for this function.
Error in pointCloud (line 142)
[xyzPoints, C, nv, I] = validateAndParseInputs(varargin{:}); I want to add a new property to a pointcloud, which is not in the standard properties of pointcloud.
I’ve got a pointcloud with one color image, from where I extract the Color inforamtion, and one NIR image, from where I get a greyscale value for each point, and I want to have every point to have an additional Property called ‘NIR’ with this value.
I tried :
pointcloud=pointCloud(posxyz,’Intensity’,intensityvalue,’NIR’,nirvalue)
Matlab gives me the following error:
Error using pointCloud>validateAndParseInputs (line 818)
‘NIR’ is not a recognized parameter. For a list of valid name-value pair arguments, see the
documentation for this function.
Error in pointCloud (line 142)
[xyzPoints, C, nv, I] = validateAndParseInputs(varargin{:}); pointcloud, porperty MATLAB Answers — New Questions
GUI plot
Hie guys, i imported an excel file into my gui and i plotted it out together with the vertical lines that i need. However, with the same code, it does not work for the other axes in the same GUI.Below are my codes,
——–first axes code———-
plot(handles.axes1,c,d);
hold on;
XData=get(get(handles.axes1,’children’),’XData’);
YData=get(get(handles.axes1,’children’),’YData’);
y_BPFO = interp1(XData,YData,BPFO);
t=get(handles.axes1,’ylim’);
plot([BPFO BPFO],t,’-y’);
———–second axes(in the same GUI)——–
plot(handles.axes2,c,d);
hold on;
XData1=get(get(handles.axes2,’children’),’XData’);
YData1=get(get(handles.axes2,’children’),’YData’);
y_BPFO1 = interp1(XData1,YData1,BPFO1);
q=get(handles.axes2,’ylim’);
plot([BPFO1 BPFO1],q,’-y’);
——————————————–
I manage to get the first plot with all the data and vertical lines.
However, i cant get the plot for the second axes. Can someone help me out?
Regards,
EanHie guys, i imported an excel file into my gui and i plotted it out together with the vertical lines that i need. However, with the same code, it does not work for the other axes in the same GUI.Below are my codes,
——–first axes code———-
plot(handles.axes1,c,d);
hold on;
XData=get(get(handles.axes1,’children’),’XData’);
YData=get(get(handles.axes1,’children’),’YData’);
y_BPFO = interp1(XData,YData,BPFO);
t=get(handles.axes1,’ylim’);
plot([BPFO BPFO],t,’-y’);
———–second axes(in the same GUI)——–
plot(handles.axes2,c,d);
hold on;
XData1=get(get(handles.axes2,’children’),’XData’);
YData1=get(get(handles.axes2,’children’),’YData’);
y_BPFO1 = interp1(XData1,YData1,BPFO1);
q=get(handles.axes2,’ylim’);
plot([BPFO1 BPFO1],q,’-y’);
——————————————–
I manage to get the first plot with all the data and vertical lines.
However, i cant get the plot for the second axes. Can someone help me out?
Regards,
Ean Hie guys, i imported an excel file into my gui and i plotted it out together with the vertical lines that i need. However, with the same code, it does not work for the other axes in the same GUI.Below are my codes,
——–first axes code———-
plot(handles.axes1,c,d);
hold on;
XData=get(get(handles.axes1,’children’),’XData’);
YData=get(get(handles.axes1,’children’),’YData’);
y_BPFO = interp1(XData,YData,BPFO);
t=get(handles.axes1,’ylim’);
plot([BPFO BPFO],t,’-y’);
———–second axes(in the same GUI)——–
plot(handles.axes2,c,d);
hold on;
XData1=get(get(handles.axes2,’children’),’XData’);
YData1=get(get(handles.axes2,’children’),’YData’);
y_BPFO1 = interp1(XData1,YData1,BPFO1);
q=get(handles.axes2,’ylim’);
plot([BPFO1 BPFO1],q,’-y’);
——————————————–
I manage to get the first plot with all the data and vertical lines.
However, i cant get the plot for the second axes. Can someone help me out?
Regards,
Ean plot MATLAB Answers — New Questions
CCDF Plot
Dose any one knows to generate CDDF polots for OFDM …plese help..strugling with itDose any one knows to generate CDDF polots for OFDM …plese help..strugling with it Dose any one knows to generate CDDF polots for OFDM …plese help..strugling with it ccdf plot, ofdm MATLAB Answers — New Questions
contourm plotting
I have a text file containing Lats and Lons. I want to plot a geomap with 0.1 deg grid. Then the map use a color bar, showing the number of occurrences of the Lats and Longs.I have a text file containing Lats and Lons. I want to plot a geomap with 0.1 deg grid. Then the map use a color bar, showing the number of occurrences of the Lats and Longs. I have a text file containing Lats and Lons. I want to plot a geomap with 0.1 deg grid. Then the map use a color bar, showing the number of occurrences of the Lats and Longs. contourm MATLAB Answers — New Questions
why do I receive PSB option menu block block (mask) does not have a parameter named ‘MechanicalLoad’
when I compiled my mlapp with simulink model,it has warning me PSB option menu block block (mask) does not have a parameter named ‘MechanicalLoad’。when I compiled my mlapp with simulink model,it has warning me PSB option menu block block (mask) does not have a parameter named ‘MechanicalLoad’。 when I compiled my mlapp with simulink model,it has warning me PSB option menu block block (mask) does not have a parameter named ‘MechanicalLoad’。 simulink app designer MATLAB Answers — New Questions