пятница, 31 марта 2017 г.
Get Started with Statistics and Machine Learning Toolbox
Getting Started with Statistics and Machine Learning Toolbox
https://www.mathworks.com/help/stats/getting-started-12.html
Machine Learning
Machine Learning for Predictive Modelling
Rory Adams, MathWorks
https://www.mathworks.com/videos/machine-learning-for-predictive-modelling-116621.html
Machine Learning with MATLAB: Getting Started with Classification
Richard Willey, MathWorks
https://www.mathworks.com/videos/machine-learning-with-matlab-getting-started-with-classification-81766.html
Applying Multivariate Classification in the Life Sciences with Statistics Toolbox
https://www.mathworks.com/matlabcentral/fileexchange/25807-applying-multivariate-classification-in-the-life-sciences-with-statistics-toolbox
https://www.mathworks.com/videos/applying-multivariate-classification-in-the-life-sciences-with-statistics-toolbox-81659.html?elqsid=1490960464073&potential_use=Home
An Introduction to Classification
Richard Willey, MathWorks
https://www.mathworks.com/videos/an-introduction-to-classification-68891.html
Machine Learnings Examples
https://www.mathworks.com/products/statistics.html
Examples Machine Learning with MATLAB
https://www.mathworks.com/campaigns/products/offer/machine-learning-with-matlab-conf.html?elqsid=1490946484814&potential_use=Home
Machine Learning Made Easy
https://www.mathworks.com/videos/machine-learning-with-matlab-100694.html?s_tid=conf_addres_DA_eb
Signal Processing and Machine Learning Techniques for Sensor Data Analytics
https://www.mathworks.com/videos/signal-processing-and-machine-learning-techniques-for-sensor-data-analytics-107549.html?s_tid=conf_addres_DA_eb
Supervised Learning Workflow and Algorithms
https://www.mathworks.com/help/stats/supervised-learning-machine-learning-workflow-and-algorithms.html?s_tid=conf_addres_DA_eb
Data-Driven Insights with MATLAB Analytics: An Energy Load Forecasting Case Study
https://www.mathworks.com/company/newsletters/articles/data-driven-insights-with-matlab-analytics-an-energy-load-forecasting-case-study.html?s_tid=conf_addres_DA_eb
MACHINE LEARNINGS Examples
https://www.mathworks.com/solutions/machine-learning/examples.html?s_tid=conf_addres_DA_eb
Classification Learner
https://www.mathworks.com/products/statistics/classification-learner.html?s_tid=conf_addres_DA_eb
MachineLearning
четверг, 30 марта 2017 г.
Finance App Examples
Using MATLAB to Develop and Deploy Financial Models
https://www.mathworks.com/videos/using-matlab-to-develop-and-deploy-financial-models-81642.html
Using MATLAB to Optimize Portfolios with Financial Toolbox
Analyzing Investment Strategies with CVaR Portfolio Optimization in MATLAB
https://www.mathworks.com/videos/analyzing-investment-strategies-with-cvar-portfolio-optimization-in-matlab-81942.html
Deep Learning ML, Caffe,
http://matlab.ru/webinars/tecnology-Deep-Learning
http://caffe.berkeleyvision.org/
http://www.vlfeat.org/matconvnet/
https://github.com/vlfeat/matconvnet
https://habrahabr.ru/post/301084/
AlexNet
https://ru.wikipedia.org/wiki/%D0%A1%D0%B2%D1%91%D1%80%D1%82%D0%BE%D1%87%D0%BD%D0%B0%D1%8F_%D0%BD%D0%B5%D0%B9%D1%80%D0%BE%D0%BD%D0%BD%D0%B0%D1%8F_%D1%81%D0%B5%D1%82%D1%8C
AlexNet
https://www.mathworks.com/matlabcentral/fileexchange/59133-neural-network-toolbox-tm--model-for-alexnet-network?s_tid=srchtitle
ML Parallel
Параллельные вычисления при моделировании с серией параметров
http://matlab.ru/videos/Parallel%27nye-vychisleniya-pri-modelirovanii-s-seriej-parametrov
среда, 29 марта 2017 г.
ML + VS
Интеграция MATLAB с Microsoft Visual Studio
http://matlab.ru/videos/integraciya-matlab-s-microsoft-visual-studio
ML Parameters Estimation
Онлайн оценка параметров модели Online Parameter Estimation
http://matlab.ru/videos/onlajn-ocenka-parametrov-modeli-online-parameter-estimation
вторник, 28 марта 2017 г.
Simple graphics examples for Matlab 3D
1. Elefant
[x,y,z] = meshgrid(-2:0.1:2);
F=(x.^2 + y.^2 + z.^2) - 3;
isosurface(x,y,z,F,0);
F=(x.^3 + y.^3 + z.^3) -2;
isosurface(x,y,z,F,0);
axis auto
axis([-3, +3 , -3, +3, -3, +3]);
2.
[x,y,z] = meshgrid(-2:0.1:2);
F=x.^2 + y.^2 + z.^2 -3;
isosurface(x,y,z,F,0);
F=x.^2 + y.^3 + z.^2 -3;
isosurface(x,y,z,F,0);
F=x.^2 + y.^3 + z.^2 +3;
isosurface(x,y,z,F,0);
axis([-2.5, +2.5 , -2.5, +2.5,-2.5, +2.5]);
% axis auto
3.
clc
[x,y,z] = meshgrid(-2:0.1:2);
F=x.^4 + y.^4 + z.^4 - (x.^2 + y.^2 + z.^2);
% surface(x,y,z,F,0)
% isosurface(x,y,z,F,0)
hpatch = patch(isosurface(x,y,z,F,0));
isonormals(x,y,z,F,hpatch); %посчитаем нормали для красоты
set(hpatch,'FaceColor','r','EdgeColor','none'); %немного цвета для красоты
camlight left; lighting phong; %немного света для красоты
[x,y,z] = meshgrid(-2:0.1:2);
F=(x.^2 + y.^2 + z.^2) - 3;
isosurface(x,y,z,F,0);
F=(x.^3 + y.^3 + z.^3) -2;
isosurface(x,y,z,F,0);
axis auto
axis([-3, +3 , -3, +3, -3, +3]);
2.
[x,y,z] = meshgrid(-2:0.1:2);
F=x.^2 + y.^2 + z.^2 -3;
isosurface(x,y,z,F,0);
F=x.^2 + y.^3 + z.^2 -3;
isosurface(x,y,z,F,0);
F=x.^2 + y.^3 + z.^2 +3;
isosurface(x,y,z,F,0);
axis([-2.5, +2.5 , -2.5, +2.5,-2.5, +2.5]);
% axis auto
3.
clc
[x,y,z] = meshgrid(-2:0.1:2);
F=x.^4 + y.^4 + z.^4 - (x.^2 + y.^2 + z.^2);
% surface(x,y,z,F,0)
% isosurface(x,y,z,F,0)
hpatch = patch(isosurface(x,y,z,F,0));
isonormals(x,y,z,F,hpatch); %посчитаем нормали для красоты
set(hpatch,'FaceColor','r','EdgeColor','none'); %немного цвета для красоты
camlight left; lighting phong; %немного света для красоты
Simple graphics examples for Matlab
1.
N = 50;
NgrStr = 6;
NgrColumn = 1;
y1 = randn(N,1);
stat.mean = mean(y);
stat.std = std(y);
stat.median = median(y);
y2 = filter([ 1 1]/2,1,y);
t = linspace(0, 0.01, N);
subplot(NgrStr,NgrColumn,1);
plot(t,y1);
grid on;
subplot(NgrStr,NgrColumn,2);
plot(t,y2);
grid on;
subplot(NgrStr,1,3);
plot(y,'DisplayName','y');hold on;plot(y2,'DisplayName','y2');hold off;
grid on;
subplot(NgrStr,NgrColumn,4);
plot(y1,y2);
grid on;
subplot(NgrStr,NgrColumn,5);
stem(y2-y1);
grid on;
subplot(NgrStr,NgrColumn,6);
hist(y2-y1);
grid on;
N = 50;
NgrStr = 6;
NgrColumn = 1;
y1 = randn(N,1);
stat.mean = mean(y);
stat.std = std(y);
stat.median = median(y);
y2 = filter([ 1 1]/2,1,y);
t = linspace(0, 0.01, N);
subplot(NgrStr,NgrColumn,1);
plot(t,y1);
grid on;
subplot(NgrStr,NgrColumn,2);
plot(t,y2);
grid on;
subplot(NgrStr,1,3);
plot(y,'DisplayName','y');hold on;plot(y2,'DisplayName','y2');hold off;
grid on;
subplot(NgrStr,NgrColumn,4);
plot(y1,y2);
grid on;
subplot(NgrStr,NgrColumn,5);
stem(y2-y1);
grid on;
subplot(NgrStr,NgrColumn,6);
hist(y2-y1);
grid on;
.Net Assembly from MatLab
.Net Assembly from MatLab
1.
NET.addAssembly('System.Speech');
ss = System.Speech.Synthesis.SpeechSynthesizer;
ss.Volume = 100;
Speak(ss,'You can use .NET Library in Matrix Laboratory');
2.
asmpath = 'D:\VC\1305\gs.trade\GS.Matlab\bin\Debug\';
asmname = 'GS.Matlab.dll';
asm = NET.addAssembly(fullfile(asmpath,asmname));
obj = GS.Matlab.MyGraph;
mlData = cell(obj.getNewData)
objArr = cell(obj.getObjectArray);
objNewDataArr = obj.getNewDataProp;
figure('Name',char(mlData{1}))
plot(double(mlData{2}(2)))
xlabel(char(mlData{2}(1)))
3.
% F:\Work\Math\Matlab\Net
% NetDocCell_01.m
R = 3;
C=1;
asmpath = 'D:\VC\1305\gs.trade\GS.Matlab\bin\Debug\';
asmname = 'GS.Matlab.dll';
asm = NET.addAssembly(fullfile(asmpath,asmname));
obj = GS.Matlab.MyGraph;
mlData = cell(obj.getNewData);
%objArr = cell(obj.getObjectArray);
objNewDataArr = obj.getNewDataProp;
figure('Name',char(mlData{1}));
subplot(R,C,1);
% figure('Name',char(mlData{1}));
plot(double(mlData{2}(2)));
xlabel(char(mlData{2}(1)));
subplot(R,C,2);
objArr = obj.getObjectArray();
doubles1 = double(objArr(1));
doubles2 = double(objArr(2));
plot([doubles1 doubles2]);
subplot(R,C,3);
objDouble = obj.getDoubleArray;
doubles = double(objDouble);
plot(doubles);
------------------------------------------------------------
.cs
D:\VC\1305\gs.trade\GS.MAtlab\
namespace GS.Matlab
{
// Call Methods from .Net Assembly from Matlab
public class MyGraph
{
public Object[] getNewData()
/*
* Create a System.Object array to use in MATLAB examples.
* Returns containerArr System.Object array containing:
* fLabel System.String object
* plotData System.Object array containing:
* xLabel System.String object
* doubleArr System.Double array
*/
{
String fLabel = "Figure Showing New Graph Data";
Double[] doubleArr =
{
18, 32, 3.133, 44, -9.9, -13, 33.03
};
String xLabel = "X-Axis Label";
Object[] plotData = {xLabel, doubleArr};
Object[] containerArr = {fLabel, plotData};
return containerArr;
}
public Object[] getNewDataProp {
get
{
String fLabel = "Figure Showing New Graph Data";
Double[] doubleArr =
{
18, 32, 3.133, 44, -9.9, -13, 33.03
};
String xLabel = "X-Axis Label";
Object[] plotData = {xLabel, doubleArr};
Object[] containerArr = {fLabel, plotData};
return containerArr;
}
}
public object[] getObjectArray()
{
var arr1 = new double[] {1, 2, 3, 4, 5};
var arr2 = new double[] { 6, 7, 8, 9, 10 };
return new object[] {arr1, arr2};
}
public double[] getDoubleArray()
{
return new double[] { 1, 2, 3, 4, 5 };
}
public object[] getObjectArrayProp => new object[]
{
new double[] {1,2,3},
new double[] {4,5,6,7,8,9}
};
public double[] getDoubleArrayProp => new double[] { 1, 2, 3, 4, 5 };
}
}
1.
NET.addAssembly('System.Speech');
ss = System.Speech.Synthesis.SpeechSynthesizer;
ss.Volume = 100;
Speak(ss,'You can use .NET Library in Matrix Laboratory');
2.
asmpath = 'D:\VC\1305\gs.trade\GS.Matlab\bin\Debug\';
asmname = 'GS.Matlab.dll';
asm = NET.addAssembly(fullfile(asmpath,asmname));
obj = GS.Matlab.MyGraph;
mlData = cell(obj.getNewData)
objArr = cell(obj.getObjectArray);
objNewDataArr = obj.getNewDataProp;
figure('Name',char(mlData{1}))
plot(double(mlData{2}(2)))
xlabel(char(mlData{2}(1)))
3.
% F:\Work\Math\Matlab\Net
% NetDocCell_01.m
R = 3;
C=1;
asmpath = 'D:\VC\1305\gs.trade\GS.Matlab\bin\Debug\';
asmname = 'GS.Matlab.dll';
asm = NET.addAssembly(fullfile(asmpath,asmname));
obj = GS.Matlab.MyGraph;
mlData = cell(obj.getNewData);
%objArr = cell(obj.getObjectArray);
objNewDataArr = obj.getNewDataProp;
figure('Name',char(mlData{1}));
subplot(R,C,1);
% figure('Name',char(mlData{1}));
plot(double(mlData{2}(2)));
xlabel(char(mlData{2}(1)));
subplot(R,C,2);
objArr = obj.getObjectArray();
doubles1 = double(objArr(1));
doubles2 = double(objArr(2));
plot([doubles1 doubles2]);
subplot(R,C,3);
objDouble = obj.getDoubleArray;
doubles = double(objDouble);
plot(doubles);
------------------------------------------------------------
.cs
D:\VC\1305\gs.trade\GS.MAtlab\
namespace GS.Matlab
{
// Call Methods from .Net Assembly from Matlab
public class MyGraph
{
public Object[] getNewData()
/*
* Create a System.Object array to use in MATLAB examples.
* Returns containerArr System.Object array containing:
* fLabel System.String object
* plotData System.Object array containing:
* xLabel System.String object
* doubleArr System.Double array
*/
{
String fLabel = "Figure Showing New Graph Data";
Double[] doubleArr =
{
18, 32, 3.133, 44, -9.9, -13, 33.03
};
String xLabel = "X-Axis Label";
Object[] plotData = {xLabel, doubleArr};
Object[] containerArr = {fLabel, plotData};
return containerArr;
}
public Object[] getNewDataProp {
get
{
String fLabel = "Figure Showing New Graph Data";
Double[] doubleArr =
{
18, 32, 3.133, 44, -9.9, -13, 33.03
};
String xLabel = "X-Axis Label";
Object[] plotData = {xLabel, doubleArr};
Object[] containerArr = {fLabel, plotData};
return containerArr;
}
}
public object[] getObjectArray()
{
var arr1 = new double[] {1, 2, 3, 4, 5};
var arr2 = new double[] { 6, 7, 8, 9, 10 };
return new object[] {arr1, arr2};
}
public double[] getDoubleArray()
{
return new double[] { 1, 2, 3, 4, 5 };
}
public object[] getObjectArrayProp => new object[]
{
new double[] {1,2,3},
new double[] {4,5,6,7,8,9}
};
public double[] getDoubleArrayProp => new double[] { 1, 2, 3, 4, 5 };
}
}
воскресенье, 26 марта 2017 г.
Track
R=2;C=2;
vz = 10; % velocity constant
a = -32; % acceleration constant
subplot(R,C,1);
t = 0:.1:1;
z = vz*t;
% z = vz*t + 1/2*a*t.^2;
vx = 2;
x = vx*t;
%x = vx*t + 1/2*a*t.^2;
vy = 3;
y = vy*t;
% y = vy*t + 1/2*a*t.^2;
u = gradient(x);
v = gradient(y);
w = gradient(z);
scale = 0;
quiver3(x,y,z,u,v,w,scale);
view([70,18]);
subplot(R,C,2)
% z = vz*t;
z = vz*t + 1/2*a*t.^2;
vx = 2;
x = vx*t;
% x = vx*t + 1/2*a*t.^2;
vy = 3;
y = vy*t;
% y = vy*t + 1/2*a*t.^2;
u = gradient(x);
v = gradient(y);
w = gradient(z);
scale = 0;
quiver3(x,y,z,u,v,w,scale);
view([70,18]);
subplot(R,C,3)
% z = vz*t;
z = vz*t + 1/2*a*t.^2;
vx = 2;
% x = vx*t;
x = vx*t + 1/2*a*t.^2;
vy = 3;
y = vy*t;
% y = vy*t + 1/2*a*t.^2;
u = gradient(x);
v = gradient(y);
w = gradient(z);
scale = 0;
quiver3(x,y,z,u,v,w,scale);
view([70,18]);
subplot(R,C,4)
% z = vz*t;
z = vz*t + 1/2*a*t.^2;
vx = 2;
% x = vx*t;
x = vx*t + 1/2*a*t.^2;
vy = 3;
%y = vy*t;
y = vy*t + 1/2*a*t.^2;
u = gradient(x);
v = gradient(y);
w = gradient(z);
scale = 0;
quiver3(x,y,z,u,v,w,scale);
view([70,18]);
vz = 10; % velocity constant
a = -32; % acceleration constant
subplot(R,C,1);
t = 0:.1:1;
z = vz*t;
% z = vz*t + 1/2*a*t.^2;
vx = 2;
x = vx*t;
%x = vx*t + 1/2*a*t.^2;
vy = 3;
y = vy*t;
% y = vy*t + 1/2*a*t.^2;
u = gradient(x);
v = gradient(y);
w = gradient(z);
scale = 0;
quiver3(x,y,z,u,v,w,scale);
view([70,18]);
subplot(R,C,2)
% z = vz*t;
z = vz*t + 1/2*a*t.^2;
vx = 2;
x = vx*t;
% x = vx*t + 1/2*a*t.^2;
vy = 3;
y = vy*t;
% y = vy*t + 1/2*a*t.^2;
u = gradient(x);
v = gradient(y);
w = gradient(z);
scale = 0;
quiver3(x,y,z,u,v,w,scale);
view([70,18]);
subplot(R,C,3)
% z = vz*t;
z = vz*t + 1/2*a*t.^2;
vx = 2;
% x = vx*t;
x = vx*t + 1/2*a*t.^2;
vy = 3;
y = vy*t;
% y = vy*t + 1/2*a*t.^2;
u = gradient(x);
v = gradient(y);
w = gradient(z);
scale = 0;
quiver3(x,y,z,u,v,w,scale);
view([70,18]);
subplot(R,C,4)
% z = vz*t;
z = vz*t + 1/2*a*t.^2;
vx = 2;
% x = vx*t;
x = vx*t + 1/2*a*t.^2;
vy = 3;
%y = vy*t;
y = vy*t + 1/2*a*t.^2;
u = gradient(x);
v = gradient(y);
w = gradient(z);
scale = 0;
quiver3(x,y,z,u,v,w,scale);
view([70,18]);
Combine Stem and Line
x = linspace(0,2*pi,60);
a = sin(x);
b = cos(x);
stem(x,a+b);
hold on
plot(x,a)
plot(x,b)
hold off
legend('a+b','a = sin(x)','b = cos(x)')
xlabel('Time in \musecs')
ylabel('Magnitude')
title('Linear Combination of Two Functions');
a = sin(x);
b = cos(x);
stem(x,a+b);
hold on
plot(x,a)
plot(x,b)
hold off
legend('a+b','a = sin(x)','b = cos(x)')
xlabel('Time in \musecs')
ylabel('Magnitude')
title('Linear Combination of Two Functions');
Include Loop Variable Value in Graph Title
x = linspace(0,10,100);
for k = 1:4
subplot(2,2,k);
yk = sin(k*x);
plot(x,yk)
title(['y = sin(' num2str(k) 'x)'])
end
Legend Mean Value + Text Signs
R=5;C=1;
dat = rand(50,1);
subplot(R,C,1);
plot(dat)
m = mean(dat);
ax = gca;
xlimits = ax.XLim;
h = line([xlimits(1),xlimits(2)],[m,m],'Color','k','LineStyle','--');
legend(h,'mean of data');
subplot(R,C,2);
g1 = hggroup;
g2 = hggroup;
t = linspace(0,2*pi,100);
plot(t,sin(t),'b','Parent',g1)
hold on
plot(t,sin(t+1/7),'b','Parent',g1)
plot(t,sin(t+2/7),'b','Parent',g1)
plot(t,sin(t+3/7),'b','Parent',g1)
plot(t,cos(t),'g','Parent',g2)
plot(t,cos(t+1/7),'g','Parent',g2)
plot(t,cos(t+2/7),'g','Parent',g2)
plot(t,cos(t+3/7),'g','Parent',g2)
hold off % reset hold state to off
legend([g1,g2],'sine','cosine')
subplot(R,C,3);
x = linspace(0,2*pi,100);
y1 = sin(x);
p1 = plot(x,y1,'DisplayName','sin(x)');
hold on
y2 = sin(x) + pi/2;
p2 = plot(x,y2,'DisplayName','sin(x) + \pi/2');
y3 = sin(x) + pi;
p3 = plot(x,y3,'DisplayName','sin(x) + \pi');
hold off
legend([p1 p2 p3])
subplot(R,C,4);
t = linspace(0,2*pi,50);
y = sin(t);
plot(t,y);
x1 = pi;
y1 = sin(pi);
str1 = '\leftarrow sin(\pi) = 0';
text(x1,y1,str1);
x2 = 3*pi/4;
y2 = sin(3*pi/4);
str2 = '\leftarrow sin(3\pi/4) = 0.71';
text(x2,y2,str2)
x3 = 5*pi/4;
y3 = sin(5*pi/4);
str3 = 'sin(5\pi/4) = -0.71 \rightarrow';
text(x3,y3,str3,'HorizontalAlignment','right');
subplot(R,C,5);
x = linspace(-3,3);
y = (x/5-x.^3).*exp(-2*x.^2);
plot(x,y);
indexmin = find(min(y) == y);
xmin = x(indexmin);
ymin = y(indexmin);
indexmax = find(max(y) == y);
xmax = x(indexmax);
ymax = y(indexmax);
strmin = ['Minimum = ',num2str(ymin)];
text(xmin,ymin,strmin,'HorizontalAlignment','left');
strmax = ['Maximum = ',num2str(ymax)];
text(xmax,ymax,strmax,'HorizontalAlignment','right');
dat = rand(50,1);
subplot(R,C,1);
plot(dat)
m = mean(dat);
ax = gca;
xlimits = ax.XLim;
h = line([xlimits(1),xlimits(2)],[m,m],'Color','k','LineStyle','--');
legend(h,'mean of data');
subplot(R,C,2);
g1 = hggroup;
g2 = hggroup;
t = linspace(0,2*pi,100);
plot(t,sin(t),'b','Parent',g1)
hold on
plot(t,sin(t+1/7),'b','Parent',g1)
plot(t,sin(t+2/7),'b','Parent',g1)
plot(t,sin(t+3/7),'b','Parent',g1)
plot(t,cos(t),'g','Parent',g2)
plot(t,cos(t+1/7),'g','Parent',g2)
plot(t,cos(t+2/7),'g','Parent',g2)
plot(t,cos(t+3/7),'g','Parent',g2)
hold off % reset hold state to off
legend([g1,g2],'sine','cosine')
subplot(R,C,3);
x = linspace(0,2*pi,100);
y1 = sin(x);
p1 = plot(x,y1,'DisplayName','sin(x)');
hold on
y2 = sin(x) + pi/2;
p2 = plot(x,y2,'DisplayName','sin(x) + \pi/2');
y3 = sin(x) + pi;
p3 = plot(x,y3,'DisplayName','sin(x) + \pi');
hold off
legend([p1 p2 p3])
subplot(R,C,4);
t = linspace(0,2*pi,50);
y = sin(t);
plot(t,y);
x1 = pi;
y1 = sin(pi);
str1 = '\leftarrow sin(\pi) = 0';
text(x1,y1,str1);
x2 = 3*pi/4;
y2 = sin(3*pi/4);
str2 = '\leftarrow sin(3\pi/4) = 0.71';
text(x2,y2,str2)
x3 = 5*pi/4;
y3 = sin(5*pi/4);
str3 = 'sin(5\pi/4) = -0.71 \rightarrow';
text(x3,y3,str3,'HorizontalAlignment','right');
subplot(R,C,5);
x = linspace(-3,3);
y = (x/5-x.^3).*exp(-2*x.^2);
plot(x,y);
indexmin = find(min(y) == y);
xmin = x(indexmin);
ymin = y(indexmin);
indexmax = find(max(y) == y);
xmax = x(indexmax);
ymax = y(indexmax);
strmin = ['Minimum = ',num2str(ymin)];
text(xmin,ymin,strmin,'HorizontalAlignment','left');
strmax = ['Maximum = ',num2str(ymax)];
text(xmax,ymax,strmax,'HorizontalAlignment','right');
Graph with Two y-Axes
1.
R = 5; C = 1;
subplot(R,C,1);
x = linspace(0,2*pi,25);
y1 = sin(x);
% y2 = 0.5*sin(x);
y2 = exp(-1/3*x).*sin(x);
plot(x,y1);
grid on
hold on
stem(x,y2);
hold off
subplot(R,C,2);
A = 1000;
a = 0.005;
b = 0.005;
t = 0:900;
z1 = A*exp(-a*t);
z2 = sin(b*t);
[ax,p1,p2] = plotyy(t,z1,t,z2,'semilogy','plot');
ylabel(ax(1),'Semilog Plot') % label left y-axis
ylabel(ax(2),'Linear Plot') % label right y-axis
xlabel(ax(2),'Time') % label x-axis
p1.LineStyle = '--';
p1.LineWidth = 2;
p2.LineWidth = 2;
grid(ax(1),'on')
R = 5; C = 1;
subplot(R,C,1);
x = linspace(0,2*pi,25);
y1 = sin(x);
% y2 = 0.5*sin(x);
y2 = exp(-1/3*x).*sin(x);
plot(x,y1);
grid on
hold on
stem(x,y2);
hold off
subplot(R,C,2);
A = 1000;
a = 0.005;
b = 0.005;
t = 0:900;
z1 = A*exp(-a*t);
z2 = sin(b*t);
[ax,p1,p2] = plotyy(t,z1,t,z2,'semilogy','plot');
ylabel(ax(1),'Semilog Plot') % label left y-axis
ylabel(ax(2),'Linear Plot') % label right y-axis
xlabel(ax(2),'Time') % label x-axis
p1.LineStyle = '--';
p1.LineWidth = 2;
p2.LineWidth = 2;
grid(ax(1),'on')
пятница, 24 марта 2017 г.
Call .Net Methods from ML
1.
R = 3;
C=1;
asmpath = 'D:\VC\1305\gs.trade\GS.Matlab\bin\Debug\';
asmname = 'GS.Matlab.dll';
asm = NET.addAssembly(fullfile(asmpath,asmname));
obj = GS.Matlab.MyGraph;
mlData = cell(obj.getNewData);
%objArr = cell(obj.getObjectArray);
objNewDataArr = obj.getNewDataProp;
figure('Name',char(mlData{1}));
subplot(R,C,1);
% figure('Name',char(mlData{1}));
plot(double(mlData{2}(2)));
xlabel(char(mlData{2}(1)));
subplot(R,C,2);
objArr = obj.getObjectArray();
doubles1 = double(objArr(1));
doubles2 = double(objArr(2));
plot([doubles1 doubles2]);
subplot(R,C,3);
objDouble = obj.getDoubleArray;
doubles = double(objDouble);
plot(doubles);
R = 3;
C=1;
asmpath = 'D:\VC\1305\gs.trade\GS.Matlab\bin\Debug\';
asmname = 'GS.Matlab.dll';
asm = NET.addAssembly(fullfile(asmpath,asmname));
obj = GS.Matlab.MyGraph;
mlData = cell(obj.getNewData);
%objArr = cell(obj.getObjectArray);
objNewDataArr = obj.getNewDataProp;
figure('Name',char(mlData{1}));
subplot(R,C,1);
% figure('Name',char(mlData{1}));
plot(double(mlData{2}(2)));
xlabel(char(mlData{2}(1)));
subplot(R,C,2);
objArr = obj.getObjectArray();
doubles1 = double(objArr(1));
doubles2 = double(objArr(2));
plot([doubles1 doubles2]);
subplot(R,C,3);
objDouble = obj.getDoubleArray;
doubles = double(objDouble);
plot(doubles);
webread matlab and Net classes
webRead
https://www.mathworks.com/help/matlab/ref/webread.html
Convert .NET Arrays to Cell Arrays
https://www.mathworks.com/help/matlab/matlab_external/net-arrays-to-cell-arrays.html
Pass Cell Arrays of .NET Data
https://www.mathworks.com/help/matlab/matlab_external/tips-for-working-with-cell-arrays-of-net-data.html
Handle Data Returned from .NET Objects
https://www.mathworks.com/help/matlab/matlab_external/handling-net-data-in-matlab_bte9owt-1.html#bte9paq-1
Access a Simple .NET Class
https://www.mathworks.com/help/matlab/matlab_external/access-a-simple-net-class.html
Call .NET Methods With ref Keyword
https://www.mathworks.com/help/matlab/matlab_external/call-net-methods-with-ref-keyword.html
Calling .NET Methods
matlab_external/calling-net-methods.html?s_tid=gn_loc_drop
Use .NET methods in MATLAB®, method signatures, arguments by reference, optional arguments
https://www.mathworks.com/help/matlab/methods-.html
Подписаться на:
Комментарии (Atom)


