How to generate fx value according to number of samples?
Ältere Kommentare anzeigen
I have a matlab code of matrix multiplication with normal distribution
I need a output corresponding to number of samples = 20
I have a thickness data by normal distribution with 10x20 matrix . That number of rows data i used to generate matrix multiplication. I need fx values corresponds with that number of columns data( i.e, i need 20 output values)
How to do this in matlab.
clc
clear
close all
x=pi:0.01:2*pi; %%% x domain
mu=25;
sigma=1.5;
n=10;
num_samples=20;
d0=25; %%% thickness of layer 1
d1= normrnd(mu,sigma,[n,num_samples]); %%% thickness of layer 2 by normal distribution
for i =1:length(x)
x_value=x(i);
X1=x_value*d0;
Fx=[sin(X1) 1i; -1i cos(X1)]; %%% Matrix for layer 1
Fy = eye(2); % Initialize total matrix as identity for layer 2
for j = 1:n
X2=x_value*d1(j);
M=[sin(X2) 1i; -1i cos(X2)]; %%% Matrix for layer 1
Fy= Fy * M;
end
Fxx=(Fx^n*Fy); %%% Matrix multiplication
fx=Fxx(1,1)+Fxx(2,2); %%% output
end
disp(fx)
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Contour Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!