Tag Archives: matlab
Correspondence between student name and Learner ID in Matlab Grader and Moodle
We are using Matlab Grader in a Moodle platform. Though we are able to detect and give feedback for most of the common errors made by our students, teachers often need to revise the code of individual students. The correspondence between Matlab Grader’s Learner ID and student’s names in Moodle must be stablished somewhere. Can we access this information? Asking our students to submit their Solution ID, a solution that I’ve seen in several of the questions posted to this community, is just not an option. The procedure ought to be automatized somehow, probably by our Moodle platform managers, but is this possible?
Best regardsWe are using Matlab Grader in a Moodle platform. Though we are able to detect and give feedback for most of the common errors made by our students, teachers often need to revise the code of individual students. The correspondence between Matlab Grader’s Learner ID and student’s names in Moodle must be stablished somewhere. Can we access this information? Asking our students to submit their Solution ID, a solution that I’ve seen in several of the questions posted to this community, is just not an option. The procedure ought to be automatized somehow, probably by our Moodle platform managers, but is this possible?
Best regards We are using Matlab Grader in a Moodle platform. Though we are able to detect and give feedback for most of the common errors made by our students, teachers often need to revise the code of individual students. The correspondence between Matlab Grader’s Learner ID and student’s names in Moodle must be stablished somewhere. Can we access this information? Asking our students to submit their Solution ID, a solution that I’ve seen in several of the questions posted to this community, is just not an option. The procedure ought to be automatized somehow, probably by our Moodle platform managers, but is this possible?
Best regards matlab grader, learner id, moodle MATLAB Answers — New Questions
how to simulate parallel inverters with different power rating ?
Hello !
I am trying to simulate a micgrogrid in which 3 pv inverters connected in parallel. Aim is to detect the island operation and to study the performance of parallel inverters. I want to make transition smooth from grid forming to grid feeding or vice versa, making a suitable control strategy and then want to improve the power quality of such microgrid. I need help in accurate simulation. Lookig for kindness in this regard if someone has worked on this problem. Pls contact me on ghh559953@gmail.comHello !
I am trying to simulate a micgrogrid in which 3 pv inverters connected in parallel. Aim is to detect the island operation and to study the performance of parallel inverters. I want to make transition smooth from grid forming to grid feeding or vice versa, making a suitable control strategy and then want to improve the power quality of such microgrid. I need help in accurate simulation. Lookig for kindness in this regard if someone has worked on this problem. Pls contact me on ghh559953@gmail.com Hello !
I am trying to simulate a micgrogrid in which 3 pv inverters connected in parallel. Aim is to detect the island operation and to study the performance of parallel inverters. I want to make transition smooth from grid forming to grid feeding or vice versa, making a suitable control strategy and then want to improve the power quality of such microgrid. I need help in accurate simulation. Lookig for kindness in this regard if someone has worked on this problem. Pls contact me on ghh559953@gmail.com all MATLAB Answers — New Questions
what is the difference between monostatic RCS and bistatic RCS?
I am currently working in MATLAB POFACETS, I know what is monostatic RADAR and what is Bistatic RADAR. But why is the radar cross section differs based on type of radar we use? Does RCS should be constant even if we use bistatic or monostatic configuration? after all backsctatter is a part of bistatic RCS calculations right?I am currently working in MATLAB POFACETS, I know what is monostatic RADAR and what is Bistatic RADAR. But why is the radar cross section differs based on type of radar we use? Does RCS should be constant even if we use bistatic or monostatic configuration? after all backsctatter is a part of bistatic RCS calculations right? I am currently working in MATLAB POFACETS, I know what is monostatic RADAR and what is Bistatic RADAR. But why is the radar cross section differs based on type of radar we use? Does RCS should be constant even if we use bistatic or monostatic configuration? after all backsctatter is a part of bistatic RCS calculations right? phased array MATLAB Answers — New Questions
Link req to verify statement in a test sequence
Hello,
Is it possible to link a requirement to a verify statement from a test sequence block?
Tnx much for support!
DianaHello,
Is it possible to link a requirement to a verify statement from a test sequence block?
Tnx much for support!
Diana Hello,
Is it possible to link a requirement to a verify statement from a test sequence block?
Tnx much for support!
Diana simulink test, simulink coverage MATLAB Answers — New Questions
How i can modified this App designer file in which RLC added like = [0.01, 10,15, 0.01] and time interval also like [ 10, 50; 50, 100; 100, 200; 200, 300] each single field.
How i can modified this App designer file in which RLC added like = [0.01, 10,15, 0.01] and time interval also like [ 10, 50; 50, 100; 100, 200; 200, 300] each in a single field. Kindly help me outHow i can modified this App designer file in which RLC added like = [0.01, 10,15, 0.01] and time interval also like [ 10, 50; 50, 100; 100, 200; 200, 300] each in a single field. Kindly help me out How i can modified this App designer file in which RLC added like = [0.01, 10,15, 0.01] and time interval also like [ 10, 50; 50, 100; 100, 200; 200, 300] each in a single field. Kindly help me out matlab gui, appdesigner MATLAB Answers — New Questions
Vertical blank space in tiledlayout compact
Dear all
I am plotting the following:
u1=figure(‘visible’,’off’,’units’,’pixels’,’position’,[0 0 1920 1080]);
t=tiledlayout(2,2,’Padding’,’compact’);
title(t,[‘Bilayer. Monte Carlo, $15$ million steps. $T=2$ K, $mathbf{H}=0$’;”;”],’FontSize’,18,’interpreter’,’latex’);
ax1=nexttile;
uimagesc(space_x,space_y,mx);
axis xy;
clim([-round(max([abs(max(max(mx))) abs(min(min(mx)))]),2) round(max([abs(max(max(mx))) abs(min(min(mx)))]),2)]);
colormap(ax1,bluewhitered(256));
box on;
clr1=colorbar(‘YTick’,[-round(max([abs(max(max(mx))) abs(min(min(mx)))]),2) -round(max([abs(max(max(mx))) abs(min(min(mx)))])/2,2) 0 round(max([abs(max(max(mx))) abs(min(min(mx)))])/2,2) round(max([abs(max(max(mx))) abs(min(min(mx)))]),2)]);
set(clr1,’TickLabelInterpreter’,’latex’);
xlabel(‘$a$-{it th} spatial direction, $a , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(‘$b$-{it th} spatial direction, $b , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(clr1,’$a$-{it th} magnetization component, $m_a$’,’Interpreter’,’Latex’,’FontSize’,16);
xlim([0 300]);
xticks([0:50:300]);
ylim([0 100]);
yticks([0:20:100]);
pbaspect([1 1/3 1]);
xtickangle(0);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,15);
ax2=nexttile;
uimagesc(space_x,space_y,my);
clim([-max([abs(max(max(my))) abs(min(min(my)))]) max([abs(max(max(my))) abs(min(min(my)))])]);
colormap(ax2,bluewhitered(256));
axis xy;
box on;
clr2=colorbar(‘YTick’,[-max([abs(max(max(my))) abs(min(min(my)))]) -max([abs(max(max(my))) abs(min(min(my)))])/2 0 max([abs(max(max(my))) abs(min(min(my)))])/2 max([abs(max(max(my))) abs(min(min(my)))])]);
set(clr2,’TickLabelInterpreter’,’latex’);
xlabel(‘$a$-{it th} spatial direction, $a , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(‘$b$-{it th} spatial direction, $b , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(clr2,’$b$-{it th} magnetization component, $m_b$’,’Interpreter’,’Latex’,’FontSize’,16);
xlim([0 300]);
xticks([0:50:300]);
ylim([0 100]);
yticks([0:20:100]);
pbaspect([1 1/3 1]);
xtickangle(0);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,15);
ax3=nexttile;
uimagesc(space_x,space_y,mz);
box on;
axis xy;
clim([-max([abs(max(max(mz))) abs(min(min(mz)))]) max([abs(max(max(mz))) abs(min(min(mz)))])]);
colormap(ax3,bluewhitered(256));
clr3=colorbar(‘YTick’,[-max([abs(max(max(mz))) abs(min(min(mz)))]) -max([abs(max(max(mz))) abs(min(min(mz)))])/2 0 max([abs(max(max(mz))) abs(min(min(mz)))])/2 max([abs(max(max(mz))) abs(min(min(mz)))])]);
set(clr3,’TickLabelInterpreter’,’latex’);
xlabel(‘$a$-{it th} spatial direction, $a , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(‘$b$-{it th} spatial direction, $b , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(clr3,’$z$-{it th} magnetization component, $m_z$’,’Interpreter’,’Latex’,’FontSize’,16);
xlim([0 300]);
xticks([0:50:300]);
ylim([0 100]);
yticks([0:20:100]);
pbaspect([1 1/3 1]);
xtickangle(0);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,15);
ax4=nexttile;
uimagesc(space_x,space_y,total_magnetization);
box on;
axis xy;
clim([0 max(max(total_magnetization))]);
colormap(ax4,cmap);
clr4=colorbar(‘YTick’,[0 max(max(total_magnetization))/5 2*max(max(total_magnetization))/5 3*max(max(total_magnetization))/5 4*max(max(total_magnetization))/5 max(max(total_magnetization))]);
set(clr4,’TickLabelInterpreter’,’latex’);
xlabel(‘$a$-{it th} spatial direction, $a , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(‘$b$-{it th} spatial direction, $b , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(clr4,’Magnetization vector modulus, $left| mathbf{m} right|$’,’Interpreter’,’Latex’,’FontSize’,16);
xlim([0 300]);
xticks([0:50:300]);
ylim([0 100]);
yticks([0:20:100]);
pbaspect([1 1/3 1]);
xtickangle(0);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,15);
set(gcf,’color’,’white’);
set(gca,’Units’,’normalized’);
set(u1,’Units’,’Inches’);
posu1=get(u1,’Position’);
set(u1,’PaperPositionMode’,’Auto’,’PaperUnits’,’Inches’,’PaperSize’,[posu1(3),posu1(4)]);
and the plot looks like:
As you can see there is some vertical unnecessary space between the two horizontal stacks of plots. I would like to reduce it to be able to put the general title "Bilayer…" far enough from the top plots.
Any ideas?Dear all
I am plotting the following:
u1=figure(‘visible’,’off’,’units’,’pixels’,’position’,[0 0 1920 1080]);
t=tiledlayout(2,2,’Padding’,’compact’);
title(t,[‘Bilayer. Monte Carlo, $15$ million steps. $T=2$ K, $mathbf{H}=0$’;”;”],’FontSize’,18,’interpreter’,’latex’);
ax1=nexttile;
uimagesc(space_x,space_y,mx);
axis xy;
clim([-round(max([abs(max(max(mx))) abs(min(min(mx)))]),2) round(max([abs(max(max(mx))) abs(min(min(mx)))]),2)]);
colormap(ax1,bluewhitered(256));
box on;
clr1=colorbar(‘YTick’,[-round(max([abs(max(max(mx))) abs(min(min(mx)))]),2) -round(max([abs(max(max(mx))) abs(min(min(mx)))])/2,2) 0 round(max([abs(max(max(mx))) abs(min(min(mx)))])/2,2) round(max([abs(max(max(mx))) abs(min(min(mx)))]),2)]);
set(clr1,’TickLabelInterpreter’,’latex’);
xlabel(‘$a$-{it th} spatial direction, $a , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(‘$b$-{it th} spatial direction, $b , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(clr1,’$a$-{it th} magnetization component, $m_a$’,’Interpreter’,’Latex’,’FontSize’,16);
xlim([0 300]);
xticks([0:50:300]);
ylim([0 100]);
yticks([0:20:100]);
pbaspect([1 1/3 1]);
xtickangle(0);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,15);
ax2=nexttile;
uimagesc(space_x,space_y,my);
clim([-max([abs(max(max(my))) abs(min(min(my)))]) max([abs(max(max(my))) abs(min(min(my)))])]);
colormap(ax2,bluewhitered(256));
axis xy;
box on;
clr2=colorbar(‘YTick’,[-max([abs(max(max(my))) abs(min(min(my)))]) -max([abs(max(max(my))) abs(min(min(my)))])/2 0 max([abs(max(max(my))) abs(min(min(my)))])/2 max([abs(max(max(my))) abs(min(min(my)))])]);
set(clr2,’TickLabelInterpreter’,’latex’);
xlabel(‘$a$-{it th} spatial direction, $a , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(‘$b$-{it th} spatial direction, $b , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(clr2,’$b$-{it th} magnetization component, $m_b$’,’Interpreter’,’Latex’,’FontSize’,16);
xlim([0 300]);
xticks([0:50:300]);
ylim([0 100]);
yticks([0:20:100]);
pbaspect([1 1/3 1]);
xtickangle(0);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,15);
ax3=nexttile;
uimagesc(space_x,space_y,mz);
box on;
axis xy;
clim([-max([abs(max(max(mz))) abs(min(min(mz)))]) max([abs(max(max(mz))) abs(min(min(mz)))])]);
colormap(ax3,bluewhitered(256));
clr3=colorbar(‘YTick’,[-max([abs(max(max(mz))) abs(min(min(mz)))]) -max([abs(max(max(mz))) abs(min(min(mz)))])/2 0 max([abs(max(max(mz))) abs(min(min(mz)))])/2 max([abs(max(max(mz))) abs(min(min(mz)))])]);
set(clr3,’TickLabelInterpreter’,’latex’);
xlabel(‘$a$-{it th} spatial direction, $a , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(‘$b$-{it th} spatial direction, $b , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(clr3,’$z$-{it th} magnetization component, $m_z$’,’Interpreter’,’Latex’,’FontSize’,16);
xlim([0 300]);
xticks([0:50:300]);
ylim([0 100]);
yticks([0:20:100]);
pbaspect([1 1/3 1]);
xtickangle(0);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,15);
ax4=nexttile;
uimagesc(space_x,space_y,total_magnetization);
box on;
axis xy;
clim([0 max(max(total_magnetization))]);
colormap(ax4,cmap);
clr4=colorbar(‘YTick’,[0 max(max(total_magnetization))/5 2*max(max(total_magnetization))/5 3*max(max(total_magnetization))/5 4*max(max(total_magnetization))/5 max(max(total_magnetization))]);
set(clr4,’TickLabelInterpreter’,’latex’);
xlabel(‘$a$-{it th} spatial direction, $a , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(‘$b$-{it th} spatial direction, $b , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(clr4,’Magnetization vector modulus, $left| mathbf{m} right|$’,’Interpreter’,’Latex’,’FontSize’,16);
xlim([0 300]);
xticks([0:50:300]);
ylim([0 100]);
yticks([0:20:100]);
pbaspect([1 1/3 1]);
xtickangle(0);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,15);
set(gcf,’color’,’white’);
set(gca,’Units’,’normalized’);
set(u1,’Units’,’Inches’);
posu1=get(u1,’Position’);
set(u1,’PaperPositionMode’,’Auto’,’PaperUnits’,’Inches’,’PaperSize’,[posu1(3),posu1(4)]);
and the plot looks like:
As you can see there is some vertical unnecessary space between the two horizontal stacks of plots. I would like to reduce it to be able to put the general title "Bilayer…" far enough from the top plots.
Any ideas? Dear all
I am plotting the following:
u1=figure(‘visible’,’off’,’units’,’pixels’,’position’,[0 0 1920 1080]);
t=tiledlayout(2,2,’Padding’,’compact’);
title(t,[‘Bilayer. Monte Carlo, $15$ million steps. $T=2$ K, $mathbf{H}=0$’;”;”],’FontSize’,18,’interpreter’,’latex’);
ax1=nexttile;
uimagesc(space_x,space_y,mx);
axis xy;
clim([-round(max([abs(max(max(mx))) abs(min(min(mx)))]),2) round(max([abs(max(max(mx))) abs(min(min(mx)))]),2)]);
colormap(ax1,bluewhitered(256));
box on;
clr1=colorbar(‘YTick’,[-round(max([abs(max(max(mx))) abs(min(min(mx)))]),2) -round(max([abs(max(max(mx))) abs(min(min(mx)))])/2,2) 0 round(max([abs(max(max(mx))) abs(min(min(mx)))])/2,2) round(max([abs(max(max(mx))) abs(min(min(mx)))]),2)]);
set(clr1,’TickLabelInterpreter’,’latex’);
xlabel(‘$a$-{it th} spatial direction, $a , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(‘$b$-{it th} spatial direction, $b , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(clr1,’$a$-{it th} magnetization component, $m_a$’,’Interpreter’,’Latex’,’FontSize’,16);
xlim([0 300]);
xticks([0:50:300]);
ylim([0 100]);
yticks([0:20:100]);
pbaspect([1 1/3 1]);
xtickangle(0);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,15);
ax2=nexttile;
uimagesc(space_x,space_y,my);
clim([-max([abs(max(max(my))) abs(min(min(my)))]) max([abs(max(max(my))) abs(min(min(my)))])]);
colormap(ax2,bluewhitered(256));
axis xy;
box on;
clr2=colorbar(‘YTick’,[-max([abs(max(max(my))) abs(min(min(my)))]) -max([abs(max(max(my))) abs(min(min(my)))])/2 0 max([abs(max(max(my))) abs(min(min(my)))])/2 max([abs(max(max(my))) abs(min(min(my)))])]);
set(clr2,’TickLabelInterpreter’,’latex’);
xlabel(‘$a$-{it th} spatial direction, $a , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(‘$b$-{it th} spatial direction, $b , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(clr2,’$b$-{it th} magnetization component, $m_b$’,’Interpreter’,’Latex’,’FontSize’,16);
xlim([0 300]);
xticks([0:50:300]);
ylim([0 100]);
yticks([0:20:100]);
pbaspect([1 1/3 1]);
xtickangle(0);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,15);
ax3=nexttile;
uimagesc(space_x,space_y,mz);
box on;
axis xy;
clim([-max([abs(max(max(mz))) abs(min(min(mz)))]) max([abs(max(max(mz))) abs(min(min(mz)))])]);
colormap(ax3,bluewhitered(256));
clr3=colorbar(‘YTick’,[-max([abs(max(max(mz))) abs(min(min(mz)))]) -max([abs(max(max(mz))) abs(min(min(mz)))])/2 0 max([abs(max(max(mz))) abs(min(min(mz)))])/2 max([abs(max(max(mz))) abs(min(min(mz)))])]);
set(clr3,’TickLabelInterpreter’,’latex’);
xlabel(‘$a$-{it th} spatial direction, $a , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(‘$b$-{it th} spatial direction, $b , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(clr3,’$z$-{it th} magnetization component, $m_z$’,’Interpreter’,’Latex’,’FontSize’,16);
xlim([0 300]);
xticks([0:50:300]);
ylim([0 100]);
yticks([0:20:100]);
pbaspect([1 1/3 1]);
xtickangle(0);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,15);
ax4=nexttile;
uimagesc(space_x,space_y,total_magnetization);
box on;
axis xy;
clim([0 max(max(total_magnetization))]);
colormap(ax4,cmap);
clr4=colorbar(‘YTick’,[0 max(max(total_magnetization))/5 2*max(max(total_magnetization))/5 3*max(max(total_magnetization))/5 4*max(max(total_magnetization))/5 max(max(total_magnetization))]);
set(clr4,’TickLabelInterpreter’,’latex’);
xlabel(‘$a$-{it th} spatial direction, $a , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(‘$b$-{it th} spatial direction, $b , , left( mathrm{nm} right)$’,’FontSize’,15,’interpreter’,’latex’);
ylabel(clr4,’Magnetization vector modulus, $left| mathbf{m} right|$’,’Interpreter’,’Latex’,’FontSize’,16);
xlim([0 300]);
xticks([0:50:300]);
ylim([0 100]);
yticks([0:20:100]);
pbaspect([1 1/3 1]);
xtickangle(0);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,15);
set(gcf,’color’,’white’);
set(gca,’Units’,’normalized’);
set(u1,’Units’,’Inches’);
posu1=get(u1,’Position’);
set(u1,’PaperPositionMode’,’Auto’,’PaperUnits’,’Inches’,’PaperSize’,[posu1(3),posu1(4)]);
and the plot looks like:
As you can see there is some vertical unnecessary space between the two horizontal stacks of plots. I would like to reduce it to be able to put the general title "Bilayer…" far enough from the top plots.
Any ideas? padding compact tiledlayout MATLAB Answers — New Questions
How can I install MATLAB without the default JRE?
I noticed that MATLAB does not ship with the newest version of the Java Runtime Environment.Can I install a newer JRE and configure MATLAB to use it?I noticed that MATLAB does not ship with the newest version of the Java Runtime Environment.Can I install a newer JRE and configure MATLAB to use it? I noticed that MATLAB does not ship with the newest version of the Java Runtime Environment.Can I install a newer JRE and configure MATLAB to use it? MATLAB Answers — New Questions
Untraining the SalsaNext model Architecture
I used the following repository to evaluate my data (https://github.com/matlab-deep-learning/pretrained-salsanext), but it loads a pretrained SalsaNext model. I would like to know whether it is possible to untrain the model, or to train it from scratch without creating the layergraph (Since this model involves a large number of layers, and the work seems to be cumbersome, and error-prone).
ThanksI used the following repository to evaluate my data (https://github.com/matlab-deep-learning/pretrained-salsanext), but it loads a pretrained SalsaNext model. I would like to know whether it is possible to untrain the model, or to train it from scratch without creating the layergraph (Since this model involves a large number of layers, and the work seems to be cumbersome, and error-prone).
Thanks I used the following repository to evaluate my data (https://github.com/matlab-deep-learning/pretrained-salsanext), but it loads a pretrained SalsaNext model. I would like to know whether it is possible to untrain the model, or to train it from scratch without creating the layergraph (Since this model involves a large number of layers, and the work seems to be cumbersome, and error-prone).
Thanks salsanext, untraining, neural network MATLAB Answers — New Questions
Designing fuzzy inference system and subsystems
Hello.I have several fuzzy systems about security, all of which have 3 outputs: weak, medium and strong. In the comprehensive system, I want to enter all these fuzzy systems and in addition ask it to calculate if it sees 10 weak cases, the final output will be the vulnerable level. Is this possible? Can you guide me?Hello.I have several fuzzy systems about security, all of which have 3 outputs: weak, medium and strong. In the comprehensive system, I want to enter all these fuzzy systems and in addition ask it to calculate if it sees 10 weak cases, the final output will be the vulnerable level. Is this possible? Can you guide me? Hello.I have several fuzzy systems about security, all of which have 3 outputs: weak, medium and strong. In the comprehensive system, I want to enter all these fuzzy systems and in addition ask it to calculate if it sees 10 weak cases, the final output will be the vulnerable level. Is this possible? Can you guide me? fuzzy inference system, fuzzy MATLAB Answers — New Questions
“Does the rotor core of the Synchronous Machine Model 1.0 include hysteresis characteristics?”
I am using the Synchronous Machine Model 1.0 in Simulink Simscape.
Does the rotor core of the Synchronous Machine Model 1.0 include hysteresis characteristics?I am using the Synchronous Machine Model 1.0 in Simulink Simscape.
Does the rotor core of the Synchronous Machine Model 1.0 include hysteresis characteristics? I am using the Synchronous Machine Model 1.0 in Simulink Simscape.
Does the rotor core of the Synchronous Machine Model 1.0 include hysteresis characteristics? simulink, simscape, electric_motor_control, model MATLAB Answers — New Questions
Problem with single agent Simulink using RL toolbox
I am using RL toolbox to train a single agent with the following specifications:
for type=1
% obsMat = [1 1];
obsMat = [4 3; 5 3; 6 3; 7 3; 8 3; 9 3; 5 11; 6 11; 7 11; 8 11; 6 12; 7 12; 3 12; ];
% obsMat = [ ];
sA0 = [2 5];
switch type
case 1
s0 = [sA0];
end
Ts = 0.1;
Tf = 100;
maxsteps = ceil(Tf/Ts);
switch type
case 1
mdl = "rlAreaCoverage1";
end
open_system(mdl)
% Define observation specifications.
obsSize = [12 12 4];
oinfo = rlNumericSpec(obsSize);
oinfo.Name = "observations";
% Define action specifications.
numAct=131
switch numAct
case 131
actionSpace = {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 129 130 131 132 133 134 136 137 140 141 142 143 144};
end
ainfo = rlFiniteSetSpec(actionSpace);
ainfo.Name = "actions";
switch type
case 1
blks = mdl + ["/Agent A (Red)"];
end
switch type
case 1
env = rlSimulinkEnv(mdl,blks,{oinfo},{ainfo});
end
env.ResetFcn = @(in) resetMap(in, obsMat);
rng(0)
but I see this error:
Error using rlSimulinkEnv>localValidateIOSpecs (line 178)
Invalid size or type for observation specification.
Error in rlSimulinkEnv (line 90)
localValidateIOSpecs(numAgents,observationInfo,actionInfo);
Do you have any idea what is wrong in my setup?I am using RL toolbox to train a single agent with the following specifications:
for type=1
% obsMat = [1 1];
obsMat = [4 3; 5 3; 6 3; 7 3; 8 3; 9 3; 5 11; 6 11; 7 11; 8 11; 6 12; 7 12; 3 12; ];
% obsMat = [ ];
sA0 = [2 5];
switch type
case 1
s0 = [sA0];
end
Ts = 0.1;
Tf = 100;
maxsteps = ceil(Tf/Ts);
switch type
case 1
mdl = "rlAreaCoverage1";
end
open_system(mdl)
% Define observation specifications.
obsSize = [12 12 4];
oinfo = rlNumericSpec(obsSize);
oinfo.Name = "observations";
% Define action specifications.
numAct=131
switch numAct
case 131
actionSpace = {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 129 130 131 132 133 134 136 137 140 141 142 143 144};
end
ainfo = rlFiniteSetSpec(actionSpace);
ainfo.Name = "actions";
switch type
case 1
blks = mdl + ["/Agent A (Red)"];
end
switch type
case 1
env = rlSimulinkEnv(mdl,blks,{oinfo},{ainfo});
end
env.ResetFcn = @(in) resetMap(in, obsMat);
rng(0)
but I see this error:
Error using rlSimulinkEnv>localValidateIOSpecs (line 178)
Invalid size or type for observation specification.
Error in rlSimulinkEnv (line 90)
localValidateIOSpecs(numAgents,observationInfo,actionInfo);
Do you have any idea what is wrong in my setup? I am using RL toolbox to train a single agent with the following specifications:
for type=1
% obsMat = [1 1];
obsMat = [4 3; 5 3; 6 3; 7 3; 8 3; 9 3; 5 11; 6 11; 7 11; 8 11; 6 12; 7 12; 3 12; ];
% obsMat = [ ];
sA0 = [2 5];
switch type
case 1
s0 = [sA0];
end
Ts = 0.1;
Tf = 100;
maxsteps = ceil(Tf/Ts);
switch type
case 1
mdl = "rlAreaCoverage1";
end
open_system(mdl)
% Define observation specifications.
obsSize = [12 12 4];
oinfo = rlNumericSpec(obsSize);
oinfo.Name = "observations";
% Define action specifications.
numAct=131
switch numAct
case 131
actionSpace = {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 129 130 131 132 133 134 136 137 140 141 142 143 144};
end
ainfo = rlFiniteSetSpec(actionSpace);
ainfo.Name = "actions";
switch type
case 1
blks = mdl + ["/Agent A (Red)"];
end
switch type
case 1
env = rlSimulinkEnv(mdl,blks,{oinfo},{ainfo});
end
env.ResetFcn = @(in) resetMap(in, obsMat);
rng(0)
but I see this error:
Error using rlSimulinkEnv>localValidateIOSpecs (line 178)
Invalid size or type for observation specification.
Error in rlSimulinkEnv (line 90)
localValidateIOSpecs(numAgents,observationInfo,actionInfo);
Do you have any idea what is wrong in my setup? reinforcement learning MATLAB Answers — New Questions
I want to plot the auto correlation function for 15 numbers without using the inbuilt function. My series is P=[ 47,64,23,71,38,64,55,41,59,48,71,35,57,40,58 ] and the plot should be autocorrelation function vs lags.
I want to plot the auto correlation function for 15 numbers without using the inbuilt function.
My code is as follows:
P=[ 47,64,23,71,38,64,55,41,59,48]; %%,71,35,57,40,58 ];
N=length(P);
Q=P(1:N);
R=P(1:N);
N1=length(Q);
N2=length(R);
u=mean(P);
sum= ((Q-u)*(R-u).’);
covar0=sum/N1;
for k=1:N-1 %% k is no. of lags and its max value can be 14 here
Q1=P(1:N-k); %% Splitting the series into 2 series separated by lag k
R1=P(1+k:N);
N1_1=length(Q1);
N2_1=length(R1);
sum1= ((Q1-u)*(R1-u).’);
covark=sum1/N;
acf=covark/covar0;
acf;
end
But after execution of the loop,I am getting acf value only for last value of k, which rather should have been an array for values of k=1 to 14.
I am new to matlab. Plz help me resolve the code.I want to plot the auto correlation function for 15 numbers without using the inbuilt function.
My code is as follows:
P=[ 47,64,23,71,38,64,55,41,59,48]; %%,71,35,57,40,58 ];
N=length(P);
Q=P(1:N);
R=P(1:N);
N1=length(Q);
N2=length(R);
u=mean(P);
sum= ((Q-u)*(R-u).’);
covar0=sum/N1;
for k=1:N-1 %% k is no. of lags and its max value can be 14 here
Q1=P(1:N-k); %% Splitting the series into 2 series separated by lag k
R1=P(1+k:N);
N1_1=length(Q1);
N2_1=length(R1);
sum1= ((Q1-u)*(R1-u).’);
covark=sum1/N;
acf=covark/covar0;
acf;
end
But after execution of the loop,I am getting acf value only for last value of k, which rather should have been an array for values of k=1 to 14.
I am new to matlab. Plz help me resolve the code. I want to plot the auto correlation function for 15 numbers without using the inbuilt function.
My code is as follows:
P=[ 47,64,23,71,38,64,55,41,59,48]; %%,71,35,57,40,58 ];
N=length(P);
Q=P(1:N);
R=P(1:N);
N1=length(Q);
N2=length(R);
u=mean(P);
sum= ((Q-u)*(R-u).’);
covar0=sum/N1;
for k=1:N-1 %% k is no. of lags and its max value can be 14 here
Q1=P(1:N-k); %% Splitting the series into 2 series separated by lag k
R1=P(1+k:N);
N1_1=length(Q1);
N2_1=length(R1);
sum1= ((Q1-u)*(R1-u).’);
covark=sum1/N;
acf=covark/covar0;
acf;
end
But after execution of the loop,I am getting acf value only for last value of k, which rather should have been an array for values of k=1 to 14.
I am new to matlab. Plz help me resolve the code. auto correlation, for loop MATLAB Answers — New Questions
Different filters for pretrainned network
if i have a group of images and i filtered all of them with 8 different filters , is there a way or method or a published something or calculate a fator to know me which filtered group is best with specific pretrainned transfer learning network for classification task using matlab without training the network with each group of filtered imagesif i have a group of images and i filtered all of them with 8 different filters , is there a way or method or a published something or calculate a fator to know me which filtered group is best with specific pretrainned transfer learning network for classification task using matlab without training the network with each group of filtered images if i have a group of images and i filtered all of them with 8 different filters , is there a way or method or a published something or calculate a fator to know me which filtered group is best with specific pretrainned transfer learning network for classification task using matlab without training the network with each group of filtered images filtering pretrainned MATLAB Answers — New Questions
How to display Chart diagram in a report, using report generator?
Hi,
I have a problem with the visualization of Chart diagram and related properties in my model.
I using this code line (in a matlab script) to search all the subsystem object (including chart):
allsubsysObj = modelObj.find(‘-isa’,’Simulink.SubSystem’,’-or’,’-isa’,’Simulink.ModelReference’,’-depth’,1);
The script find the number of element that i’m expected (2 chart and 2 subsytem) but when i tried to put the diagram figure i obtained the inner content of the subsytem and the chart.
auxpara = CenterDiagram(Diagram(allsubsysObj(1)),R);
Cap = Text(strcat("Figure ",num2str(ChCounter),".",num2str(FigCounter),": ",allsubsysObj(1).Name," subsystem"));
Cap.Style = [{FontSize(Str.CapFontSize)},{Color(Str.CapColor)},{Bold(true)},{HAlign(Str.CapAlign)}];
FigCounter = FigCounter + 1;
subsec.add(auxpara);
subsec.add(Cap);
subsec.add(LineBreak());
How i can insert only the top level diagram of the chart?Hi,
I have a problem with the visualization of Chart diagram and related properties in my model.
I using this code line (in a matlab script) to search all the subsystem object (including chart):
allsubsysObj = modelObj.find(‘-isa’,’Simulink.SubSystem’,’-or’,’-isa’,’Simulink.ModelReference’,’-depth’,1);
The script find the number of element that i’m expected (2 chart and 2 subsytem) but when i tried to put the diagram figure i obtained the inner content of the subsytem and the chart.
auxpara = CenterDiagram(Diagram(allsubsysObj(1)),R);
Cap = Text(strcat("Figure ",num2str(ChCounter),".",num2str(FigCounter),": ",allsubsysObj(1).Name," subsystem"));
Cap.Style = [{FontSize(Str.CapFontSize)},{Color(Str.CapColor)},{Bold(true)},{HAlign(Str.CapAlign)}];
FigCounter = FigCounter + 1;
subsec.add(auxpara);
subsec.add(Cap);
subsec.add(LineBreak());
How i can insert only the top level diagram of the chart? Hi,
I have a problem with the visualization of Chart diagram and related properties in my model.
I using this code line (in a matlab script) to search all the subsystem object (including chart):
allsubsysObj = modelObj.find(‘-isa’,’Simulink.SubSystem’,’-or’,’-isa’,’Simulink.ModelReference’,’-depth’,1);
The script find the number of element that i’m expected (2 chart and 2 subsytem) but when i tried to put the diagram figure i obtained the inner content of the subsytem and the chart.
auxpara = CenterDiagram(Diagram(allsubsysObj(1)),R);
Cap = Text(strcat("Figure ",num2str(ChCounter),".",num2str(FigCounter),": ",allsubsysObj(1).Name," subsystem"));
Cap.Style = [{FontSize(Str.CapFontSize)},{Color(Str.CapColor)},{Bold(true)},{HAlign(Str.CapAlign)}];
FigCounter = FigCounter + 1;
subsec.add(auxpara);
subsec.add(Cap);
subsec.add(LineBreak());
How i can insert only the top level diagram of the chart? report generation MATLAB Answers — New Questions
sinad() function verification problems
Hi, I am doing DSP with sinad() function.
I wonder :
1.How sinad() verify the "wanted signal" and how is the notch filter decided?
It seems that if I put some different 1k audio raw datas into sinad(), it has different notch bandwidth
2. sinad() use a periodogram and kaiser window with beta=38, how is this decided?Hi, I am doing DSP with sinad() function.
I wonder :
1.How sinad() verify the "wanted signal" and how is the notch filter decided?
It seems that if I put some different 1k audio raw datas into sinad(), it has different notch bandwidth
2. sinad() use a periodogram and kaiser window with beta=38, how is this decided? Hi, I am doing DSP with sinad() function.
I wonder :
1.How sinad() verify the "wanted signal" and how is the notch filter decided?
It seems that if I put some different 1k audio raw datas into sinad(), it has different notch bandwidth
2. sinad() use a periodogram and kaiser window with beta=38, how is this decided? sinad, dsp, fft, periodogram MATLAB Answers — New Questions
Matlab HDL cosimulation for Lattice CPLD
I regularly develop VHDL code for controllers that is supposed to run on FPGAs/CPLDs and I’m looking for possibilities to co-simulate this code in a closed-loop simulation environment that mimics the behavior of the controlled system. So what I would like to have is that I can define a dyamic model in Matlab (e.g., as a state-space model or a transfer function) and to simulate this model together with the controller’s HDL implementation using the outputs of the models as stimuli for the controller and the output of the controller as input for the dynamic model. Is there any way I can accomplish this with Matlab? If so, what do I have to look for?
What I found so far is apparently called HDL verifier and seems to be pretty much what I want. However, I’m currently using Lattice MachXO2 CPLDs and Lattice diamond comes with "ModelSim Lattice FPGA Edition" as a simulator. According to this post
https://ch.mathworks.com/matlabcentral/answers/493504-which-modelsim-editions-can-i-use-for-cosimulation-with-hdl-verifier
HDL verifier requires a FLI (foreign language interface), which the Lattice Edition of ModelSim does not provide. Is there any way I can use HDL verifier, e.g., by using a different simulator?I regularly develop VHDL code for controllers that is supposed to run on FPGAs/CPLDs and I’m looking for possibilities to co-simulate this code in a closed-loop simulation environment that mimics the behavior of the controlled system. So what I would like to have is that I can define a dyamic model in Matlab (e.g., as a state-space model or a transfer function) and to simulate this model together with the controller’s HDL implementation using the outputs of the models as stimuli for the controller and the output of the controller as input for the dynamic model. Is there any way I can accomplish this with Matlab? If so, what do I have to look for?
What I found so far is apparently called HDL verifier and seems to be pretty much what I want. However, I’m currently using Lattice MachXO2 CPLDs and Lattice diamond comes with "ModelSim Lattice FPGA Edition" as a simulator. According to this post
https://ch.mathworks.com/matlabcentral/answers/493504-which-modelsim-editions-can-i-use-for-cosimulation-with-hdl-verifier
HDL verifier requires a FLI (foreign language interface), which the Lattice Edition of ModelSim does not provide. Is there any way I can use HDL verifier, e.g., by using a different simulator? I regularly develop VHDL code for controllers that is supposed to run on FPGAs/CPLDs and I’m looking for possibilities to co-simulate this code in a closed-loop simulation environment that mimics the behavior of the controlled system. So what I would like to have is that I can define a dyamic model in Matlab (e.g., as a state-space model or a transfer function) and to simulate this model together with the controller’s HDL implementation using the outputs of the models as stimuli for the controller and the output of the controller as input for the dynamic model. Is there any way I can accomplish this with Matlab? If so, what do I have to look for?
What I found so far is apparently called HDL verifier and seems to be pretty much what I want. However, I’m currently using Lattice MachXO2 CPLDs and Lattice diamond comes with "ModelSim Lattice FPGA Edition" as a simulator. According to this post
https://ch.mathworks.com/matlabcentral/answers/493504-which-modelsim-editions-can-i-use-for-cosimulation-with-hdl-verifier
HDL verifier requires a FLI (foreign language interface), which the Lattice Edition of ModelSim does not provide. Is there any way I can use HDL verifier, e.g., by using a different simulator? vhdl, hdl simulation, hdl verifier, cosimlation, fpga MATLAB Answers — New Questions
How to display a color bar in Matlab as shown below
Hello, experts.
I want to draw a color bar with discontinuous and regular intervals like the first picture above.
However, it would be best to draw a continuous color bar like the second picture. Is there a solution?Hello, experts.
I want to draw a color bar with discontinuous and regular intervals like the first picture above.
However, it would be best to draw a continuous color bar like the second picture. Is there a solution? Hello, experts.
I want to draw a color bar with discontinuous and regular intervals like the first picture above.
However, it would be best to draw a continuous color bar like the second picture. Is there a solution? colorbar, colormap, colormapeditor MATLAB Answers — New Questions
How to train Unet semantic segmentation with only one single class/label?
Hello, I’m currently working on a task to do a semantic segmentation on USG image to locate TMJ. I did my image labelling in Image Labeler App and only did one class so that the class region will be 1 and background is 0. I was about to train my model with unetLayers but it says "The value of ‘numClasses’ is invalid. Expected numClasses to be a scalar with value > 1."
I’m aware that someone asked this similar question here with an answer, but I want to ask, how to customize specifically unetLayers to accomodate single class? I see that unetLayers also has softmaxLayers but i can’t find the pixel layers. Thank you in advance!Hello, I’m currently working on a task to do a semantic segmentation on USG image to locate TMJ. I did my image labelling in Image Labeler App and only did one class so that the class region will be 1 and background is 0. I was about to train my model with unetLayers but it says "The value of ‘numClasses’ is invalid. Expected numClasses to be a scalar with value > 1."
I’m aware that someone asked this similar question here with an answer, but I want to ask, how to customize specifically unetLayers to accomodate single class? I see that unetLayers also has softmaxLayers but i can’t find the pixel layers. Thank you in advance! Hello, I’m currently working on a task to do a semantic segmentation on USG image to locate TMJ. I did my image labelling in Image Labeler App and only did one class so that the class region will be 1 and background is 0. I was about to train my model with unetLayers but it says "The value of ‘numClasses’ is invalid. Expected numClasses to be a scalar with value > 1."
I’m aware that someone asked this similar question here with an answer, but I want to ask, how to customize specifically unetLayers to accomodate single class? I see that unetLayers also has softmaxLayers but i can’t find the pixel layers. Thank you in advance! deep learning MATLAB Answers — New Questions
Troubleshooting Build Error in MAC Apple Silicon Processor for Simulink Support Package for Arduino Hardware
Build for any Target Hardware selected fails for MAC Apple Silicon Processor with the following error "bad CPU Type in executable".Build for any Target Hardware selected fails for MAC Apple Silicon Processor with the following error "bad CPU Type in executable". Build for any Target Hardware selected fails for MAC Apple Silicon Processor with the following error "bad CPU Type in executable". arduino, simulink, matlab, mac MATLAB Answers — New Questions
FFT of 3D array in MATLAB
I am trying to understand how the FFT of different directions in MATLAB works to reproduce in C/C++ instead.
So far I have the following simple example in MATLAB:
clearvars; clc; close all;
%3D FFT test
Nx = 8;
Ny = 4;
Nz= 6;
Lx =16;
Ly = 6;
dx = Lx/Nx;
dy = Ly/Ny;
%———–
xi_x = (2*pi)/Lx;
yi_y = (2*pi)/Ly;
xi = ((0:Nx-1)/Nx)*(2*pi);
yi = ((0:Ny-1)/Ny)*(2*pi);
x = xi/xi_x;
y = yi/yi_y;
zlow = 0; %a
zupp =6; %b
Lz = (zupp-zlow);
eta_zgl = 2/Lz;
[D,zgl] = cheb(Nz);
zgl = (1/2)*(((zupp-zlow)*zgl) + (zupp+zlow));
[X,Z,Y] = meshgrid(x,zgl,y); %this gives 3d grid with z-by-x-by-y size (i.e. ZXY)
%ICs
A = 2*pi / Lx;
B = 2*pi / Ly;
u = (Z-zlow) .* (Z-zupp) .* sin(A*X).* sin(B*Y);
uh1 =(fft(u,[],3));%ZXY
uh2 =(fft(u,[],1));%ZXY
uh3 =(fft(u,[],2));%ZXY
So, in C/C++ I have a 3D tensor with (Nz+1) rows and Nx coumns and Ny matrices and taking the 1D FFT along each "row" of u returns the same results as the following in MATLAB:
uh3 =(fft(u,[],2));%ZXY
While taking the 1D FFT of u along each column of u in C/C++ returns the same result as the following in MATLAB:
uh2 =(fft(u,[],1));%ZXY
Then my question is what does this 1D FFT represent? and how should I represent it in C/C++?
uh1 =(fft(u,[],3));%ZXY
The cheb(N) function is:
function [ D, x ] = cheb ( N )
if ( N == 0 )
D = 0.0;
x = 1.0;
return
end
x = cos ( pi * ( 0 : N ) / N )’;
c = [ 2.0; ones(N-1,1); 2.0 ] .* (-1.0).^(0:N)’;
X = repmat ( x, 1, N + 1 );
dX = X – X’;
% Set the off diagonal entries.
D =( c * (1.0 ./ c )’ ) ./ ( dX + ( eye ( N + 1 ) ) );
% Diagonal entries.
D = D – diag ( sum ( D’ ) );
return
endI am trying to understand how the FFT of different directions in MATLAB works to reproduce in C/C++ instead.
So far I have the following simple example in MATLAB:
clearvars; clc; close all;
%3D FFT test
Nx = 8;
Ny = 4;
Nz= 6;
Lx =16;
Ly = 6;
dx = Lx/Nx;
dy = Ly/Ny;
%———–
xi_x = (2*pi)/Lx;
yi_y = (2*pi)/Ly;
xi = ((0:Nx-1)/Nx)*(2*pi);
yi = ((0:Ny-1)/Ny)*(2*pi);
x = xi/xi_x;
y = yi/yi_y;
zlow = 0; %a
zupp =6; %b
Lz = (zupp-zlow);
eta_zgl = 2/Lz;
[D,zgl] = cheb(Nz);
zgl = (1/2)*(((zupp-zlow)*zgl) + (zupp+zlow));
[X,Z,Y] = meshgrid(x,zgl,y); %this gives 3d grid with z-by-x-by-y size (i.e. ZXY)
%ICs
A = 2*pi / Lx;
B = 2*pi / Ly;
u = (Z-zlow) .* (Z-zupp) .* sin(A*X).* sin(B*Y);
uh1 =(fft(u,[],3));%ZXY
uh2 =(fft(u,[],1));%ZXY
uh3 =(fft(u,[],2));%ZXY
So, in C/C++ I have a 3D tensor with (Nz+1) rows and Nx coumns and Ny matrices and taking the 1D FFT along each "row" of u returns the same results as the following in MATLAB:
uh3 =(fft(u,[],2));%ZXY
While taking the 1D FFT of u along each column of u in C/C++ returns the same result as the following in MATLAB:
uh2 =(fft(u,[],1));%ZXY
Then my question is what does this 1D FFT represent? and how should I represent it in C/C++?
uh1 =(fft(u,[],3));%ZXY
The cheb(N) function is:
function [ D, x ] = cheb ( N )
if ( N == 0 )
D = 0.0;
x = 1.0;
return
end
x = cos ( pi * ( 0 : N ) / N )’;
c = [ 2.0; ones(N-1,1); 2.0 ] .* (-1.0).^(0:N)’;
X = repmat ( x, 1, N + 1 );
dX = X – X’;
% Set the off diagonal entries.
D =( c * (1.0 ./ c )’ ) ./ ( dX + ( eye ( N + 1 ) ) );
% Diagonal entries.
D = D – diag ( sum ( D’ ) );
return
end I am trying to understand how the FFT of different directions in MATLAB works to reproduce in C/C++ instead.
So far I have the following simple example in MATLAB:
clearvars; clc; close all;
%3D FFT test
Nx = 8;
Ny = 4;
Nz= 6;
Lx =16;
Ly = 6;
dx = Lx/Nx;
dy = Ly/Ny;
%———–
xi_x = (2*pi)/Lx;
yi_y = (2*pi)/Ly;
xi = ((0:Nx-1)/Nx)*(2*pi);
yi = ((0:Ny-1)/Ny)*(2*pi);
x = xi/xi_x;
y = yi/yi_y;
zlow = 0; %a
zupp =6; %b
Lz = (zupp-zlow);
eta_zgl = 2/Lz;
[D,zgl] = cheb(Nz);
zgl = (1/2)*(((zupp-zlow)*zgl) + (zupp+zlow));
[X,Z,Y] = meshgrid(x,zgl,y); %this gives 3d grid with z-by-x-by-y size (i.e. ZXY)
%ICs
A = 2*pi / Lx;
B = 2*pi / Ly;
u = (Z-zlow) .* (Z-zupp) .* sin(A*X).* sin(B*Y);
uh1 =(fft(u,[],3));%ZXY
uh2 =(fft(u,[],1));%ZXY
uh3 =(fft(u,[],2));%ZXY
So, in C/C++ I have a 3D tensor with (Nz+1) rows and Nx coumns and Ny matrices and taking the 1D FFT along each "row" of u returns the same results as the following in MATLAB:
uh3 =(fft(u,[],2));%ZXY
While taking the 1D FFT of u along each column of u in C/C++ returns the same result as the following in MATLAB:
uh2 =(fft(u,[],1));%ZXY
Then my question is what does this 1D FFT represent? and how should I represent it in C/C++?
uh1 =(fft(u,[],3));%ZXY
The cheb(N) function is:
function [ D, x ] = cheb ( N )
if ( N == 0 )
D = 0.0;
x = 1.0;
return
end
x = cos ( pi * ( 0 : N ) / N )’;
c = [ 2.0; ones(N-1,1); 2.0 ] .* (-1.0).^(0:N)’;
X = repmat ( x, 1, N + 1 );
dX = X – X’;
% Set the off diagonal entries.
D =( c * (1.0 ./ c )’ ) ./ ( dX + ( eye ( N + 1 ) ) );
% Diagonal entries.
D = D – diag ( sum ( D’ ) );
return
end meshgrid, fft, numerical libraries, c/c++ MATLAB Answers — New Questions