Category: Matlab
Category Archives: Matlab
我从pytorch中导入net到工作区,在把net导入到simulink中的matlab function中,在运行过程中出现如下问题Code generation for custom layer ‘aten__linear0’ for target ‘mkldnn’ is not supported as it returns a dlarra
classdef aten__linear0 < nnet.layer.Layer & nnet.layer.Formattable & …
nnet.layer.AutogeneratedFromPyTorch & nnet.layer.Acceleratable
%aten__linear0 Auto-generated custom layer
% Auto-generated by MATLAB on 2024-05-24 16:18:35
%#codegen
properties (Learnable)
% Networks (type dlnetwork)
end
properties
% Non-Trainable Parameters
end
properties (Learnable)
% Trainable Parameters
Param_weight
Param_bias
end
methods
function obj = aten__linear0(Name, Type, InputNames, OutputNames)
obj.Name = Name;
obj.Type = Type;
obj.NumInputs = 1;
obj.NumOutputs = 1;
obj.InputNames = InputNames;
obj.OutputNames = OutputNames;
end
function [linear_9] = predict(obj,linear_x_1)
%Validates that the input has the correct format and permutes its dimensions into the reverse of the original PyTorch format.
model_tt.ops.validateInput(linear_x_1,2);
[linear_x_1, linear_x_1_format] = model_tt.ops.permuteInputToReversePyTorch(linear_x_1, 2);
[linear_x_1] = struct(‘value’, linear_x_1, ‘rank’, int64(2));
[linear_9] = tracedPyTorchFunction(obj,linear_x_1,false,"predict");
%Permute U-labelled output to forward PyTorch dimension ordering
if(any(dims(linear_9.value) == ‘U’))
linear_9 = permute(linear_9.value, fliplr(1:max(2,linear_9.rank)));
end
end
function [linear_9] = forward(obj,linear_x_1)
%Validates that the input has the correct format and permutes its dimensions into the reverse of the original PyTorch format.
model_tt.ops.validateInput(linear_x_1,2);
[linear_x_1, linear_x_1_format] = model_tt.ops.permuteInputToReversePyTorch(linear_x_1, 2);
[linear_x_1] = struct(‘value’, linear_x_1, ‘rank’, int64(2));
[linear_9] = tracedPyTorchFunction(obj,linear_x_1,true,"forward");
%Permute U-labelled output to forward PyTorch dimension ordering
if(any(dims(linear_9.value) == ‘U’))
linear_9 = permute(linear_9.value, fliplr(1:max(2,linear_9.rank)));
end
end
function [linear_9] = tracedPyTorchFunction(obj,linear_x_1,isForward,predict)
linear_weight_1 = obj.Param_weight;
[linear_weight_1] = struct(‘value’, dlarray(linear_weight_1,’UU’), ‘rank’, 2);
linear_bias_1 = obj.Param_bias;
[linear_bias_1] = struct(‘value’, dlarray(linear_bias_1,’UU’), ‘rank’, 1);
[linear_9] = model_tt.ops.pyLinear(linear_x_1, linear_weight_1, linear_bias_1);
end
end
endclassdef aten__linear0 < nnet.layer.Layer & nnet.layer.Formattable & …
nnet.layer.AutogeneratedFromPyTorch & nnet.layer.Acceleratable
%aten__linear0 Auto-generated custom layer
% Auto-generated by MATLAB on 2024-05-24 16:18:35
%#codegen
properties (Learnable)
% Networks (type dlnetwork)
end
properties
% Non-Trainable Parameters
end
properties (Learnable)
% Trainable Parameters
Param_weight
Param_bias
end
methods
function obj = aten__linear0(Name, Type, InputNames, OutputNames)
obj.Name = Name;
obj.Type = Type;
obj.NumInputs = 1;
obj.NumOutputs = 1;
obj.InputNames = InputNames;
obj.OutputNames = OutputNames;
end
function [linear_9] = predict(obj,linear_x_1)
%Validates that the input has the correct format and permutes its dimensions into the reverse of the original PyTorch format.
model_tt.ops.validateInput(linear_x_1,2);
[linear_x_1, linear_x_1_format] = model_tt.ops.permuteInputToReversePyTorch(linear_x_1, 2);
[linear_x_1] = struct(‘value’, linear_x_1, ‘rank’, int64(2));
[linear_9] = tracedPyTorchFunction(obj,linear_x_1,false,"predict");
%Permute U-labelled output to forward PyTorch dimension ordering
if(any(dims(linear_9.value) == ‘U’))
linear_9 = permute(linear_9.value, fliplr(1:max(2,linear_9.rank)));
end
end
function [linear_9] = forward(obj,linear_x_1)
%Validates that the input has the correct format and permutes its dimensions into the reverse of the original PyTorch format.
model_tt.ops.validateInput(linear_x_1,2);
[linear_x_1, linear_x_1_format] = model_tt.ops.permuteInputToReversePyTorch(linear_x_1, 2);
[linear_x_1] = struct(‘value’, linear_x_1, ‘rank’, int64(2));
[linear_9] = tracedPyTorchFunction(obj,linear_x_1,true,"forward");
%Permute U-labelled output to forward PyTorch dimension ordering
if(any(dims(linear_9.value) == ‘U’))
linear_9 = permute(linear_9.value, fliplr(1:max(2,linear_9.rank)));
end
end
function [linear_9] = tracedPyTorchFunction(obj,linear_x_1,isForward,predict)
linear_weight_1 = obj.Param_weight;
[linear_weight_1] = struct(‘value’, dlarray(linear_weight_1,’UU’), ‘rank’, 2);
linear_bias_1 = obj.Param_bias;
[linear_bias_1] = struct(‘value’, dlarray(linear_bias_1,’UU’), ‘rank’, 1);
[linear_9] = model_tt.ops.pyLinear(linear_x_1, linear_weight_1, linear_bias_1);
end
end
end classdef aten__linear0 < nnet.layer.Layer & nnet.layer.Formattable & …
nnet.layer.AutogeneratedFromPyTorch & nnet.layer.Acceleratable
%aten__linear0 Auto-generated custom layer
% Auto-generated by MATLAB on 2024-05-24 16:18:35
%#codegen
properties (Learnable)
% Networks (type dlnetwork)
end
properties
% Non-Trainable Parameters
end
properties (Learnable)
% Trainable Parameters
Param_weight
Param_bias
end
methods
function obj = aten__linear0(Name, Type, InputNames, OutputNames)
obj.Name = Name;
obj.Type = Type;
obj.NumInputs = 1;
obj.NumOutputs = 1;
obj.InputNames = InputNames;
obj.OutputNames = OutputNames;
end
function [linear_9] = predict(obj,linear_x_1)
%Validates that the input has the correct format and permutes its dimensions into the reverse of the original PyTorch format.
model_tt.ops.validateInput(linear_x_1,2);
[linear_x_1, linear_x_1_format] = model_tt.ops.permuteInputToReversePyTorch(linear_x_1, 2);
[linear_x_1] = struct(‘value’, linear_x_1, ‘rank’, int64(2));
[linear_9] = tracedPyTorchFunction(obj,linear_x_1,false,"predict");
%Permute U-labelled output to forward PyTorch dimension ordering
if(any(dims(linear_9.value) == ‘U’))
linear_9 = permute(linear_9.value, fliplr(1:max(2,linear_9.rank)));
end
end
function [linear_9] = forward(obj,linear_x_1)
%Validates that the input has the correct format and permutes its dimensions into the reverse of the original PyTorch format.
model_tt.ops.validateInput(linear_x_1,2);
[linear_x_1, linear_x_1_format] = model_tt.ops.permuteInputToReversePyTorch(linear_x_1, 2);
[linear_x_1] = struct(‘value’, linear_x_1, ‘rank’, int64(2));
[linear_9] = tracedPyTorchFunction(obj,linear_x_1,true,"forward");
%Permute U-labelled output to forward PyTorch dimension ordering
if(any(dims(linear_9.value) == ‘U’))
linear_9 = permute(linear_9.value, fliplr(1:max(2,linear_9.rank)));
end
end
function [linear_9] = tracedPyTorchFunction(obj,linear_x_1,isForward,predict)
linear_weight_1 = obj.Param_weight;
[linear_weight_1] = struct(‘value’, dlarray(linear_weight_1,’UU’), ‘rank’, 2);
linear_bias_1 = obj.Param_bias;
[linear_bias_1] = struct(‘value’, dlarray(linear_bias_1,’UU’), ‘rank’, 1);
[linear_9] = model_tt.ops.pyLinear(linear_x_1, linear_weight_1, linear_bias_1);
end
end
end simulink, neural network MATLAB Answers — New Questions
Figure Not Displaying Properly
Hello, I’m messing around with different slices of the brain, as shown below. Each image is essentially a 2D array visualized using imagesc, where each "pixel" corresponds to an element of the array. However, the subplots don’t appear to be scaling properly at all. Both the sagittal and coronal slice are 140 elements "tall", however because I assume MATLAB individually scales each subplot a certain way, they do not appear to be as tall as each other whatsoever. Similarly, the transverse slice should be as tall as the sagittal slice is wide (and the coronal slice should be as tall as the transverse slice is wide), but not of these dimensions match up. Here is a snippet of my code for troubleshooting purposes:
% sagittal slice, 165×140 2D array. for recreation purposes,
% you could functionally just make an 165×140 random matrix
ax1 = subplot(1, 3, 1);
imagesc(squeeze(maxS));
colormap(flipud(gray));
title("Sagittal View");
axis off;
axis image;
% coronal slice, 124×140 2D array
ax2 = subplot(1, 3, 2);
imagesc(squeeze(maxC));
colormap(flipud(gray));
title("Coronal View");
axis off;
axis image;
% transverse slice, 165×124 2D array
ax3 = subplot(1, 3, 3);
imagesc(maxT);
colormap(flipud(gray));
title("Transverse View");
axis off;
axis image;
Any and all help would be greatly appreciated. Thank you.Hello, I’m messing around with different slices of the brain, as shown below. Each image is essentially a 2D array visualized using imagesc, where each "pixel" corresponds to an element of the array. However, the subplots don’t appear to be scaling properly at all. Both the sagittal and coronal slice are 140 elements "tall", however because I assume MATLAB individually scales each subplot a certain way, they do not appear to be as tall as each other whatsoever. Similarly, the transverse slice should be as tall as the sagittal slice is wide (and the coronal slice should be as tall as the transverse slice is wide), but not of these dimensions match up. Here is a snippet of my code for troubleshooting purposes:
% sagittal slice, 165×140 2D array. for recreation purposes,
% you could functionally just make an 165×140 random matrix
ax1 = subplot(1, 3, 1);
imagesc(squeeze(maxS));
colormap(flipud(gray));
title("Sagittal View");
axis off;
axis image;
% coronal slice, 124×140 2D array
ax2 = subplot(1, 3, 2);
imagesc(squeeze(maxC));
colormap(flipud(gray));
title("Coronal View");
axis off;
axis image;
% transverse slice, 165×124 2D array
ax3 = subplot(1, 3, 3);
imagesc(maxT);
colormap(flipud(gray));
title("Transverse View");
axis off;
axis image;
Any and all help would be greatly appreciated. Thank you. Hello, I’m messing around with different slices of the brain, as shown below. Each image is essentially a 2D array visualized using imagesc, where each "pixel" corresponds to an element of the array. However, the subplots don’t appear to be scaling properly at all. Both the sagittal and coronal slice are 140 elements "tall", however because I assume MATLAB individually scales each subplot a certain way, they do not appear to be as tall as each other whatsoever. Similarly, the transverse slice should be as tall as the sagittal slice is wide (and the coronal slice should be as tall as the transverse slice is wide), but not of these dimensions match up. Here is a snippet of my code for troubleshooting purposes:
% sagittal slice, 165×140 2D array. for recreation purposes,
% you could functionally just make an 165×140 random matrix
ax1 = subplot(1, 3, 1);
imagesc(squeeze(maxS));
colormap(flipud(gray));
title("Sagittal View");
axis off;
axis image;
% coronal slice, 124×140 2D array
ax2 = subplot(1, 3, 2);
imagesc(squeeze(maxC));
colormap(flipud(gray));
title("Coronal View");
axis off;
axis image;
% transverse slice, 165×124 2D array
ax3 = subplot(1, 3, 3);
imagesc(maxT);
colormap(flipud(gray));
title("Transverse View");
axis off;
axis image;
Any and all help would be greatly appreciated. Thank you. figure MATLAB Answers — New Questions
App not supported on Apple Silicon
Was trying to use Transmission Line app on M2 Air but got an error saying it isn’t supported on apple silicon. I’m currently installing it on parallels so I know all of the features and apps work, but is there a way to get it to work on Mac? I’d hate to have to run a VM for MATLAB.
Thank you.Was trying to use Transmission Line app on M2 Air but got an error saying it isn’t supported on apple silicon. I’m currently installing it on parallels so I know all of the features and apps work, but is there a way to get it to work on Mac? I’d hate to have to run a VM for MATLAB.
Thank you. Was trying to use Transmission Line app on M2 Air but got an error saying it isn’t supported on apple silicon. I’m currently installing it on parallels so I know all of the features and apps work, but is there a way to get it to work on Mac? I’d hate to have to run a VM for MATLAB.
Thank you. mac, m2, rf toolbox MATLAB Answers — New Questions
How can I programmatically modify an Excel file with AIP sensitivity tags?
My company has recently decided to make Excel create files automatically with Azure Information Protection (AIP) sensitivity labels. We have programs in MATLAB that modify Excel files, but because of this, they have started to fail when trying to modify the files. Specifically, when using the writetable function, MATLAB shows the following error:
Unable to write to file ‘D:Prueba xlswriteBenchmark_Colones_1-2años_31-03-2024.xlsx’.
Ensure the file is a valid spreadsheet file and is not password protected.
Is there a way to programmatically provide the credentials needed by Excel to be able to modify the file when it is allowed?My company has recently decided to make Excel create files automatically with Azure Information Protection (AIP) sensitivity labels. We have programs in MATLAB that modify Excel files, but because of this, they have started to fail when trying to modify the files. Specifically, when using the writetable function, MATLAB shows the following error:
Unable to write to file ‘D:Prueba xlswriteBenchmark_Colones_1-2años_31-03-2024.xlsx’.
Ensure the file is a valid spreadsheet file and is not password protected.
Is there a way to programmatically provide the credentials needed by Excel to be able to modify the file when it is allowed? My company has recently decided to make Excel create files automatically with Azure Information Protection (AIP) sensitivity labels. We have programs in MATLAB that modify Excel files, but because of this, they have started to fail when trying to modify the files. Specifically, when using the writetable function, MATLAB shows the following error:
Unable to write to file ‘D:Prueba xlswriteBenchmark_Colones_1-2años_31-03-2024.xlsx’.
Ensure the file is a valid spreadsheet file and is not password protected.
Is there a way to programmatically provide the credentials needed by Excel to be able to modify the file when it is allowed? writetable, excel, aip MATLAB Answers — New Questions
how can i apply for a paid internship or job
hi my name is andres ima undergrad student currently in UMASS boston and im in need of a job or at least an internship to gain some experience as a software engineer or data analyst i am a veteran and i would like to join mathworks in my state is there a place i can go apply or talk to someone? thank you so much. heres my contact information andres.gamboa001@umb.edu
number is 508-494-0584
sincerely andres gamboahi my name is andres ima undergrad student currently in UMASS boston and im in need of a job or at least an internship to gain some experience as a software engineer or data analyst i am a veteran and i would like to join mathworks in my state is there a place i can go apply or talk to someone? thank you so much. heres my contact information andres.gamboa001@umb.edu
number is 508-494-0584
sincerely andres gamboa hi my name is andres ima undergrad student currently in UMASS boston and im in need of a job or at least an internship to gain some experience as a software engineer or data analyst i am a veteran and i would like to join mathworks in my state is there a place i can go apply or talk to someone? thank you so much. heres my contact information andres.gamboa001@umb.edu
number is 508-494-0584
sincerely andres gamboa job MATLAB Answers — New Questions
Complex value computed by model function, fitting cannot continue. Try using or tightening upper and lower bounds on coefficients.
Hello, I really need some help on data fitting. I would like to fit my data custom equation:a+b*exp((-(x/c))^d. I try to use upper and lower bounds on coefficients but it does not work.If anyone can tell me what to do to resolve this I would greatly appreciate it.Hello, I really need some help on data fitting. I would like to fit my data custom equation:a+b*exp((-(x/c))^d. I try to use upper and lower bounds on coefficients but it does not work.If anyone can tell me what to do to resolve this I would greatly appreciate it. Hello, I really need some help on data fitting. I would like to fit my data custom equation:a+b*exp((-(x/c))^d. I try to use upper and lower bounds on coefficients but it does not work.If anyone can tell me what to do to resolve this I would greatly appreciate it. curve fitting, data fitting MATLAB Answers — New Questions
How to Generate Smooth Transitional Trapezoidal Signal in Simulink
Hi, everyone. I want to generate a custom signal demonstrated as follow image in Simulink, I have tried the Signal Editor Block, but the generated trapezoidal signal does not have smooth transition as showed in the attached image.
I would be appreciated that someone could give me some suggestions.Hi, everyone. I want to generate a custom signal demonstrated as follow image in Simulink, I have tried the Signal Editor Block, but the generated trapezoidal signal does not have smooth transition as showed in the attached image.
I would be appreciated that someone could give me some suggestions. Hi, everyone. I want to generate a custom signal demonstrated as follow image in Simulink, I have tried the Signal Editor Block, but the generated trapezoidal signal does not have smooth transition as showed in the attached image.
I would be appreciated that someone could give me some suggestions. signal generation, trapezoidal signal, simulink MATLAB Answers — New Questions
Matlab is not recognizing sections %%
I am working with Matlab 2018a and for some reason Matlab stop recognizing my sections (%%). Maybe I did something after messing in Home>Preferences, but I’m not really sure. Has anyone had this problem before? I’ve look online and people say "Enable Cell Mode", but I have no idea how to do this in 2018a.
thanks in advance.I am working with Matlab 2018a and for some reason Matlab stop recognizing my sections (%%). Maybe I did something after messing in Home>Preferences, but I’m not really sure. Has anyone had this problem before? I’ve look online and people say "Enable Cell Mode", but I have no idea how to do this in 2018a.
thanks in advance. I am working with Matlab 2018a and for some reason Matlab stop recognizing my sections (%%). Maybe I did something after messing in Home>Preferences, but I’m not really sure. Has anyone had this problem before? I’ve look online and people say "Enable Cell Mode", but I have no idea how to do this in 2018a.
thanks in advance. sections MATLAB Answers — New Questions
Drawing the major and minor axis of an elliptical object in Matlab
This program currently inputs an image of a coin, thresholds it, binarizes it, and finds the major and minor axis lengths of the segmented elliptical using the regionprops function. What I want to do is output a subplot where I draw the axes used to calculate the ‘MajorAxisLength’ and ‘MinorAxisLength’ over the original image. Would really appreciate help with this.
I have appended the code for your perusal.
rgbImage = imread(coin2.jpg);
subplot(2, 3, 1);
imshow(rgbImage, []);
title(‘Original Image’);
redChannel = rgbImage(:, :, 1);
binaryImage = redChannel < 100;
subplot(2, 3, 3);
imshow(binaryImage, []);
title(‘Binarized Image’);
labeledImage = bwlabel(binaryImage);
area_measurements = regionprops(labeledImage,’Area’);
allAreas = [area_measurements.Area];
biggestBlobIndex = find(allAreas == max(allAreas));
keeperBlobsImage = ismember(labeledImage, biggestBlobIndex);
measurements = regionprops(keeperBlobsImage,’MajorAxisLength’,’MinorAxisLength’)
% Display the original color image with outline.
subplot(2, 3, 4);
imshow(rgbImage);
hold on;
title(‘Original Color Image with Outline’, ‘FontSize’,fontSize);
boundaries = bwboundaries(keeperBlobsImage);
blobBoundary = boundaries{1};
plot(blobBoundary(:,2), blobBoundary(:,1), ‘g-‘, ‘LineWidth’, 1);
hold off;This program currently inputs an image of a coin, thresholds it, binarizes it, and finds the major and minor axis lengths of the segmented elliptical using the regionprops function. What I want to do is output a subplot where I draw the axes used to calculate the ‘MajorAxisLength’ and ‘MinorAxisLength’ over the original image. Would really appreciate help with this.
I have appended the code for your perusal.
rgbImage = imread(coin2.jpg);
subplot(2, 3, 1);
imshow(rgbImage, []);
title(‘Original Image’);
redChannel = rgbImage(:, :, 1);
binaryImage = redChannel < 100;
subplot(2, 3, 3);
imshow(binaryImage, []);
title(‘Binarized Image’);
labeledImage = bwlabel(binaryImage);
area_measurements = regionprops(labeledImage,’Area’);
allAreas = [area_measurements.Area];
biggestBlobIndex = find(allAreas == max(allAreas));
keeperBlobsImage = ismember(labeledImage, biggestBlobIndex);
measurements = regionprops(keeperBlobsImage,’MajorAxisLength’,’MinorAxisLength’)
% Display the original color image with outline.
subplot(2, 3, 4);
imshow(rgbImage);
hold on;
title(‘Original Color Image with Outline’, ‘FontSize’,fontSize);
boundaries = bwboundaries(keeperBlobsImage);
blobBoundary = boundaries{1};
plot(blobBoundary(:,2), blobBoundary(:,1), ‘g-‘, ‘LineWidth’, 1);
hold off; This program currently inputs an image of a coin, thresholds it, binarizes it, and finds the major and minor axis lengths of the segmented elliptical using the regionprops function. What I want to do is output a subplot where I draw the axes used to calculate the ‘MajorAxisLength’ and ‘MinorAxisLength’ over the original image. Would really appreciate help with this.
I have appended the code for your perusal.
rgbImage = imread(coin2.jpg);
subplot(2, 3, 1);
imshow(rgbImage, []);
title(‘Original Image’);
redChannel = rgbImage(:, :, 1);
binaryImage = redChannel < 100;
subplot(2, 3, 3);
imshow(binaryImage, []);
title(‘Binarized Image’);
labeledImage = bwlabel(binaryImage);
area_measurements = regionprops(labeledImage,’Area’);
allAreas = [area_measurements.Area];
biggestBlobIndex = find(allAreas == max(allAreas));
keeperBlobsImage = ismember(labeledImage, biggestBlobIndex);
measurements = regionprops(keeperBlobsImage,’MajorAxisLength’,’MinorAxisLength’)
% Display the original color image with outline.
subplot(2, 3, 4);
imshow(rgbImage);
hold on;
title(‘Original Color Image with Outline’, ‘FontSize’,fontSize);
boundaries = bwboundaries(keeperBlobsImage);
blobBoundary = boundaries{1};
plot(blobBoundary(:,2), blobBoundary(:,1), ‘g-‘, ‘LineWidth’, 1);
hold off; matlab, image-processing MATLAB Answers — New Questions
How to remove trailing zeros while display any floating point number ?
format short g;
X=input (‘any>’);
%if input is 93.93
disp (X);
It display 93.930
How to disp 93.93
I can’t remove
format short g;
Bcz of another mathematical reasons and calculations…format short g;
X=input (‘any>’);
%if input is 93.93
disp (X);
It display 93.930
How to disp 93.93
I can’t remove
format short g;
Bcz of another mathematical reasons and calculations… format short g;
X=input (‘any>’);
%if input is 93.93
disp (X);
It display 93.930
How to disp 93.93
I can’t remove
format short g;
Bcz of another mathematical reasons and calculations… zeros, format MATLAB Answers — New Questions
System Requirements – x86-64 and OpenGL version
I have two questions about the system requirements listed here:
https://au.mathworks.com/support/requirements/matlab-system-requirements.html
1) How do I tell if a processor is "x86-64" type. I suspect they all are these days, but they either don’t bother putting it in the specs list or use a different term.
2) Will it work just as well with an OpenGL version greater than 3.3? EG 4.6?I have two questions about the system requirements listed here:
https://au.mathworks.com/support/requirements/matlab-system-requirements.html
1) How do I tell if a processor is "x86-64" type. I suspect they all are these days, but they either don’t bother putting it in the specs list or use a different term.
2) Will it work just as well with an OpenGL version greater than 3.3? EG 4.6? I have two questions about the system requirements listed here:
https://au.mathworks.com/support/requirements/matlab-system-requirements.html
1) How do I tell if a processor is "x86-64" type. I suspect they all are these days, but they either don’t bother putting it in the specs list or use a different term.
2) Will it work just as well with an OpenGL version greater than 3.3? EG 4.6? system requirements, x86-64, opengl MATLAB Answers — New Questions
How to report/flag a user or a ThingSpeak channel?
When I find spammers, I often tend to check their profile to see what else needs cleaned up. Occasionally there are accounts like these:
https://www.mathworks.com/matlabcentral/profile/authors/32134539
https://www.mathworks.com/matlabcentral/profile/authors/34100453
Both of these accounts had been pasting dumb exploit attempts on either the forum or FEX, which have since been deleted. In both cases though, they left behind some extra trash on ThingSpeak.
The problem is that I see no way to report content on ThingSpeak, and the Report button rarely shows up on user profile pages. For me, in Firefox, only the second profile page has one.
As far as I’m concerned, there’s no point keeping these disposed spam accounts around, so I’m not terribly concerned with reporting the ThingSpeak channels. I just want to know how to report/flag the accounts when the button won’t show up. I guess let’s start with figuring out whether I’m the only one that can’t see the button.When I find spammers, I often tend to check their profile to see what else needs cleaned up. Occasionally there are accounts like these:
https://www.mathworks.com/matlabcentral/profile/authors/32134539
https://www.mathworks.com/matlabcentral/profile/authors/34100453
Both of these accounts had been pasting dumb exploit attempts on either the forum or FEX, which have since been deleted. In both cases though, they left behind some extra trash on ThingSpeak.
The problem is that I see no way to report content on ThingSpeak, and the Report button rarely shows up on user profile pages. For me, in Firefox, only the second profile page has one.
As far as I’m concerned, there’s no point keeping these disposed spam accounts around, so I’m not terribly concerned with reporting the ThingSpeak channels. I just want to know how to report/flag the accounts when the button won’t show up. I guess let’s start with figuring out whether I’m the only one that can’t see the button. When I find spammers, I often tend to check their profile to see what else needs cleaned up. Occasionally there are accounts like these:
https://www.mathworks.com/matlabcentral/profile/authors/32134539
https://www.mathworks.com/matlabcentral/profile/authors/34100453
Both of these accounts had been pasting dumb exploit attempts on either the forum or FEX, which have since been deleted. In both cases though, they left behind some extra trash on ThingSpeak.
The problem is that I see no way to report content on ThingSpeak, and the Report button rarely shows up on user profile pages. For me, in Firefox, only the second profile page has one.
As far as I’m concerned, there’s no point keeping these disposed spam accounts around, so I’m not terribly concerned with reporting the ThingSpeak channels. I just want to know how to report/flag the accounts when the button won’t show up. I guess let’s start with figuring out whether I’m the only one that can’t see the button. meta MATLAB Answers — New Questions
solving 1D drift diffusion model for a semiconductor using FDTD. Can anyone rectify this error.
% Constants and parameters
q = 1.602e-19; % elementary charge
k = 1.38e-23; % Boltzmann constant
eps0 = 8.85e-12; % vacuum permittivity
epsr = 11.7; % relative permittivity of silicon
Na = 1e17; % doping concentration (p-type)
L = 1e-6; % length of the semiconductor
mu_e = 1000*1e-4; % electron mobility
mu_h = 1000*1e-4; % hole mobility
D_e = k*300*mu_e/q; % electron diffusion coefficient
D_h = k*300*mu_h/q; % hole diffusion coefficient
T = 300; % temperature
V = 0.1; % applied voltage
% Spatial and time parameters
nx = 100; % number of spatial grid points
dx = L/nx; % spatial step
dt = 1e-9; % time step
nt = 100; % number of time steps
% Initialize carrier densities and electric potential
n = zeros(nx, 1); % electron density
p = zeros(nx, 1); % hole density
phi = zeros(nx, 1); % electric potential
phi(1) = V; % boundary condition at x=0
% Simulation loop
for t = 1:nt
% Calculate electric field
E = -(phi(2:end) – phi(1:end-1))/dx;
% Calculate electron and hole densities
Jn = q*D_e*(n(3:end) – n(2:end-1))/dx – q*mu_e*E.*n(2:end-1);
Jp = q*D_h*(p(3:end) – p(2:end-1))/dx + q*mu_h*E.*p(2:end-1);
% Update carrier densities
n(2:end-1) = n(2:end-1) + dt*Na./(1+exp((phi(2:end-1)-V/2)/(k*T))) – dt*Jn;
p(2:end-1) = p(2:end-1) + dt*Na./(1+exp((V/2-phi(2:end-1))/(k*T))) – dt*Jp;
% Update electric potential
rho = q*(Na – n – p); % charge density
phi(2:end-1) = phi(2:end-1) + dt*1/(epsr*eps0)*rho(2:end-1);
end% Constants and parameters
q = 1.602e-19; % elementary charge
k = 1.38e-23; % Boltzmann constant
eps0 = 8.85e-12; % vacuum permittivity
epsr = 11.7; % relative permittivity of silicon
Na = 1e17; % doping concentration (p-type)
L = 1e-6; % length of the semiconductor
mu_e = 1000*1e-4; % electron mobility
mu_h = 1000*1e-4; % hole mobility
D_e = k*300*mu_e/q; % electron diffusion coefficient
D_h = k*300*mu_h/q; % hole diffusion coefficient
T = 300; % temperature
V = 0.1; % applied voltage
% Spatial and time parameters
nx = 100; % number of spatial grid points
dx = L/nx; % spatial step
dt = 1e-9; % time step
nt = 100; % number of time steps
% Initialize carrier densities and electric potential
n = zeros(nx, 1); % electron density
p = zeros(nx, 1); % hole density
phi = zeros(nx, 1); % electric potential
phi(1) = V; % boundary condition at x=0
% Simulation loop
for t = 1:nt
% Calculate electric field
E = -(phi(2:end) – phi(1:end-1))/dx;
% Calculate electron and hole densities
Jn = q*D_e*(n(3:end) – n(2:end-1))/dx – q*mu_e*E.*n(2:end-1);
Jp = q*D_h*(p(3:end) – p(2:end-1))/dx + q*mu_h*E.*p(2:end-1);
% Update carrier densities
n(2:end-1) = n(2:end-1) + dt*Na./(1+exp((phi(2:end-1)-V/2)/(k*T))) – dt*Jn;
p(2:end-1) = p(2:end-1) + dt*Na./(1+exp((V/2-phi(2:end-1))/(k*T))) – dt*Jp;
% Update electric potential
rho = q*(Na – n – p); % charge density
phi(2:end-1) = phi(2:end-1) + dt*1/(epsr*eps0)*rho(2:end-1);
end % Constants and parameters
q = 1.602e-19; % elementary charge
k = 1.38e-23; % Boltzmann constant
eps0 = 8.85e-12; % vacuum permittivity
epsr = 11.7; % relative permittivity of silicon
Na = 1e17; % doping concentration (p-type)
L = 1e-6; % length of the semiconductor
mu_e = 1000*1e-4; % electron mobility
mu_h = 1000*1e-4; % hole mobility
D_e = k*300*mu_e/q; % electron diffusion coefficient
D_h = k*300*mu_h/q; % hole diffusion coefficient
T = 300; % temperature
V = 0.1; % applied voltage
% Spatial and time parameters
nx = 100; % number of spatial grid points
dx = L/nx; % spatial step
dt = 1e-9; % time step
nt = 100; % number of time steps
% Initialize carrier densities and electric potential
n = zeros(nx, 1); % electron density
p = zeros(nx, 1); % hole density
phi = zeros(nx, 1); % electric potential
phi(1) = V; % boundary condition at x=0
% Simulation loop
for t = 1:nt
% Calculate electric field
E = -(phi(2:end) – phi(1:end-1))/dx;
% Calculate electron and hole densities
Jn = q*D_e*(n(3:end) – n(2:end-1))/dx – q*mu_e*E.*n(2:end-1);
Jp = q*D_h*(p(3:end) – p(2:end-1))/dx + q*mu_h*E.*p(2:end-1);
% Update carrier densities
n(2:end-1) = n(2:end-1) + dt*Na./(1+exp((phi(2:end-1)-V/2)/(k*T))) – dt*Jn;
p(2:end-1) = p(2:end-1) + dt*Na./(1+exp((V/2-phi(2:end-1))/(k*T))) – dt*Jp;
% Update electric potential
rho = q*(Na – n – p); % charge density
phi(2:end-1) = phi(2:end-1) + dt*1/(epsr*eps0)*rho(2:end-1);
end fdtd, drift diffusion model MATLAB Answers — New Questions
pearsrnd and pearspdf are not coherent for the Pearson IV distribution?
We are having some trouble using the Pearson 4 implementation of the functions pearsrnd, pearspdf and pearscdf.
We think that pearsrnd does not generate samples from the distribution defined in pearspdf. In particular, we’ve found that pearsrnd over generates observations in the tails of the distribution.
In order to see this, we’ve implemented two simple tests:
1. We’ve compared the PDF of the Pearson 4 distribution (using pearspdf) to the PDF obtained from a simulation using pearsrnd, but we’ve found that the two are very different (even with a very long sample). This problem doesn’t happen for other distributions. In particular, we’ve implemented the same test with the Pearson 6, and the results are satisfactory.
2. In addition, to test if the generatated sample is compatible with its CDF, we’ve applied the function pearscdf to the generated sample. We should have got a uniform distribution, because if X is a random variable and F its CDF, then F(X) is uniform in [0,1]. This is indeed what we’ve got with the Pearson 6, as expected, but not what we’ve got using the Pearson 4.
We’ve conducted a similar experiment using Mathematica, and we get the correct result.
We’ve attached the code we’ve used.
Any idea why we’re getting this result?
Thank you very much.
%% Seed
rng(123)
%% Parameters
%Type IV
mu4 = 5;
sigma4 = 1;
skew4 = 1;
kurt4 = 10;
% Check the distribution type
[ign, type4] = pearsrnd(mu4, sigma4, skew4, kurt4, 1);
disp("This Pearson is of type " + type4)
% Type VI
mu6 = 2;
sigma6 = 1;
skew6 = 2;
kurt6 = 10;
% Check the distribution type
[ign, type6] = pearsrnd(mu6, sigma6, skew6, kurt6, 1);
disp("This Pearson is of type " + type6)
%% Simulate n observations according to both Pearson distributions defined above
n = 100000;
samples4 = pearsrnd(mu4, sigma4, skew4, kurt4, 1, n);
samples6 = pearsrnd(mu6, sigma6, skew6, kurt6, 1, n);
%% First test: we compare the simulated pdf (i.e. histogram of the sample) to the closed form PDF
pdf4 = @(x) pearspdf(x, mu4, sigma4, skew4, kurt4);
pdf6 = @(x) pearspdf(x, mu6, sigma6, skew6, kurt6);
x_ = linspace(-10, 10, 10000);
y4 = pdf4(x_);
y6 = pdf6(x_);
figure(‘Position’, [100, 100, 1000, 400]); % [left, bottom, width, height]
subplot(1, 2, 1);
plot(x_, y4, Color=’red’, LineWidth=2)
title(‘Simulated and closed form PDF for Pearson 4’)
hold on
histogram(samples4, 1000, ‘Normalization’, ‘pdf’, ‘FaceColor’, ‘blue’)
hold off
subplot(1, 2, 2);
plot(x_, y6, Color=’red’, LineWidth=2)
title(‘Simulated and closed form PDF for Pearson 6’)
hold on
histogram(samples6, 1000, ‘Normalization’, ‘pdf’, ‘FaceColor’, ‘blue’)
hold off
sgtitle(‘Test 1: Comparison between Pearson 4 and 6’);
%% Second test: Let X be a random variable and F its CDF, then F(X) is uniform in [0,1].
% We apply the Pearson CDF to the simulated observations and plot its
% histogram. We should obtain something resembling a uniform distribution.
figure(‘Position’, [100, 100, 1000, 400]); % [left, bottom, width, height]
subplot(1, 2, 1);
u4 = pearscdf(samples4, mu4, sigma4, skew4, kurt4);
histogram(u4)
title(‘F(X) for Pearson 4’)
subplot(1, 2, 2);
u6 = pearscdf(samples6, mu6, sigma6, skew6, kurt6);
histogram(u6)
title(‘F(X) for Pearson 6’)
sgtitle(‘Test 2: Comparison between Pearson 4 and 6’);
%% Conclusion
%We get the expected results using the Pearson 6, but we cannot say the
%same for the Pearson 4. Why?We are having some trouble using the Pearson 4 implementation of the functions pearsrnd, pearspdf and pearscdf.
We think that pearsrnd does not generate samples from the distribution defined in pearspdf. In particular, we’ve found that pearsrnd over generates observations in the tails of the distribution.
In order to see this, we’ve implemented two simple tests:
1. We’ve compared the PDF of the Pearson 4 distribution (using pearspdf) to the PDF obtained from a simulation using pearsrnd, but we’ve found that the two are very different (even with a very long sample). This problem doesn’t happen for other distributions. In particular, we’ve implemented the same test with the Pearson 6, and the results are satisfactory.
2. In addition, to test if the generatated sample is compatible with its CDF, we’ve applied the function pearscdf to the generated sample. We should have got a uniform distribution, because if X is a random variable and F its CDF, then F(X) is uniform in [0,1]. This is indeed what we’ve got with the Pearson 6, as expected, but not what we’ve got using the Pearson 4.
We’ve conducted a similar experiment using Mathematica, and we get the correct result.
We’ve attached the code we’ve used.
Any idea why we’re getting this result?
Thank you very much.
%% Seed
rng(123)
%% Parameters
%Type IV
mu4 = 5;
sigma4 = 1;
skew4 = 1;
kurt4 = 10;
% Check the distribution type
[ign, type4] = pearsrnd(mu4, sigma4, skew4, kurt4, 1);
disp("This Pearson is of type " + type4)
% Type VI
mu6 = 2;
sigma6 = 1;
skew6 = 2;
kurt6 = 10;
% Check the distribution type
[ign, type6] = pearsrnd(mu6, sigma6, skew6, kurt6, 1);
disp("This Pearson is of type " + type6)
%% Simulate n observations according to both Pearson distributions defined above
n = 100000;
samples4 = pearsrnd(mu4, sigma4, skew4, kurt4, 1, n);
samples6 = pearsrnd(mu6, sigma6, skew6, kurt6, 1, n);
%% First test: we compare the simulated pdf (i.e. histogram of the sample) to the closed form PDF
pdf4 = @(x) pearspdf(x, mu4, sigma4, skew4, kurt4);
pdf6 = @(x) pearspdf(x, mu6, sigma6, skew6, kurt6);
x_ = linspace(-10, 10, 10000);
y4 = pdf4(x_);
y6 = pdf6(x_);
figure(‘Position’, [100, 100, 1000, 400]); % [left, bottom, width, height]
subplot(1, 2, 1);
plot(x_, y4, Color=’red’, LineWidth=2)
title(‘Simulated and closed form PDF for Pearson 4’)
hold on
histogram(samples4, 1000, ‘Normalization’, ‘pdf’, ‘FaceColor’, ‘blue’)
hold off
subplot(1, 2, 2);
plot(x_, y6, Color=’red’, LineWidth=2)
title(‘Simulated and closed form PDF for Pearson 6’)
hold on
histogram(samples6, 1000, ‘Normalization’, ‘pdf’, ‘FaceColor’, ‘blue’)
hold off
sgtitle(‘Test 1: Comparison between Pearson 4 and 6’);
%% Second test: Let X be a random variable and F its CDF, then F(X) is uniform in [0,1].
% We apply the Pearson CDF to the simulated observations and plot its
% histogram. We should obtain something resembling a uniform distribution.
figure(‘Position’, [100, 100, 1000, 400]); % [left, bottom, width, height]
subplot(1, 2, 1);
u4 = pearscdf(samples4, mu4, sigma4, skew4, kurt4);
histogram(u4)
title(‘F(X) for Pearson 4’)
subplot(1, 2, 2);
u6 = pearscdf(samples6, mu6, sigma6, skew6, kurt6);
histogram(u6)
title(‘F(X) for Pearson 6’)
sgtitle(‘Test 2: Comparison between Pearson 4 and 6’);
%% Conclusion
%We get the expected results using the Pearson 6, but we cannot say the
%same for the Pearson 4. Why? We are having some trouble using the Pearson 4 implementation of the functions pearsrnd, pearspdf and pearscdf.
We think that pearsrnd does not generate samples from the distribution defined in pearspdf. In particular, we’ve found that pearsrnd over generates observations in the tails of the distribution.
In order to see this, we’ve implemented two simple tests:
1. We’ve compared the PDF of the Pearson 4 distribution (using pearspdf) to the PDF obtained from a simulation using pearsrnd, but we’ve found that the two are very different (even with a very long sample). This problem doesn’t happen for other distributions. In particular, we’ve implemented the same test with the Pearson 6, and the results are satisfactory.
2. In addition, to test if the generatated sample is compatible with its CDF, we’ve applied the function pearscdf to the generated sample. We should have got a uniform distribution, because if X is a random variable and F its CDF, then F(X) is uniform in [0,1]. This is indeed what we’ve got with the Pearson 6, as expected, but not what we’ve got using the Pearson 4.
We’ve conducted a similar experiment using Mathematica, and we get the correct result.
We’ve attached the code we’ve used.
Any idea why we’re getting this result?
Thank you very much.
%% Seed
rng(123)
%% Parameters
%Type IV
mu4 = 5;
sigma4 = 1;
skew4 = 1;
kurt4 = 10;
% Check the distribution type
[ign, type4] = pearsrnd(mu4, sigma4, skew4, kurt4, 1);
disp("This Pearson is of type " + type4)
% Type VI
mu6 = 2;
sigma6 = 1;
skew6 = 2;
kurt6 = 10;
% Check the distribution type
[ign, type6] = pearsrnd(mu6, sigma6, skew6, kurt6, 1);
disp("This Pearson is of type " + type6)
%% Simulate n observations according to both Pearson distributions defined above
n = 100000;
samples4 = pearsrnd(mu4, sigma4, skew4, kurt4, 1, n);
samples6 = pearsrnd(mu6, sigma6, skew6, kurt6, 1, n);
%% First test: we compare the simulated pdf (i.e. histogram of the sample) to the closed form PDF
pdf4 = @(x) pearspdf(x, mu4, sigma4, skew4, kurt4);
pdf6 = @(x) pearspdf(x, mu6, sigma6, skew6, kurt6);
x_ = linspace(-10, 10, 10000);
y4 = pdf4(x_);
y6 = pdf6(x_);
figure(‘Position’, [100, 100, 1000, 400]); % [left, bottom, width, height]
subplot(1, 2, 1);
plot(x_, y4, Color=’red’, LineWidth=2)
title(‘Simulated and closed form PDF for Pearson 4’)
hold on
histogram(samples4, 1000, ‘Normalization’, ‘pdf’, ‘FaceColor’, ‘blue’)
hold off
subplot(1, 2, 2);
plot(x_, y6, Color=’red’, LineWidth=2)
title(‘Simulated and closed form PDF for Pearson 6’)
hold on
histogram(samples6, 1000, ‘Normalization’, ‘pdf’, ‘FaceColor’, ‘blue’)
hold off
sgtitle(‘Test 1: Comparison between Pearson 4 and 6’);
%% Second test: Let X be a random variable and F its CDF, then F(X) is uniform in [0,1].
% We apply the Pearson CDF to the simulated observations and plot its
% histogram. We should obtain something resembling a uniform distribution.
figure(‘Position’, [100, 100, 1000, 400]); % [left, bottom, width, height]
subplot(1, 2, 1);
u4 = pearscdf(samples4, mu4, sigma4, skew4, kurt4);
histogram(u4)
title(‘F(X) for Pearson 4’)
subplot(1, 2, 2);
u6 = pearscdf(samples6, mu6, sigma6, skew6, kurt6);
histogram(u6)
title(‘F(X) for Pearson 6’)
sgtitle(‘Test 2: Comparison between Pearson 4 and 6’);
%% Conclusion
%We get the expected results using the Pearson 6, but we cannot say the
%same for the Pearson 4. Why? pearson, distribution, statistics, random number generator, type iv MATLAB Answers — New Questions
fenêtrage d’une image scannographie
si vous plait comment je peux appliquer un fenêtrage sur une image Dicom selon les paramètres de centre de la fenêtre et de largeur de la fenêtre voila les valeurs des paramètres (WL=40 WW=85)si vous plait comment je peux appliquer un fenêtrage sur une image Dicom selon les paramètres de centre de la fenêtre et de largeur de la fenêtre voila les valeurs des paramètres (WL=40 WW=85) si vous plait comment je peux appliquer un fenêtrage sur une image Dicom selon les paramètres de centre de la fenêtre et de largeur de la fenêtre voila les valeurs des paramètres (WL=40 WW=85) dicom, fenetrage, image MATLAB Answers — New Questions
The following MATLAB code implements the down-sampling operation with M = 2:
clear all, close all, clc
% Down-sampling
N = 41 ; % Length of the sequence
n = 0:N-1; % Time index
x = 0.6*sin(2*pi*0.0625 *n)+0.3*sin(2*pi*0.2*n); % Original signal
M = 2; % Down-sampling factor
y = x(1:M:N); % Down-sampled signal
Ny = length(y); % Length of the down-sampled sequence
figure
subplot(211),
stem(0:N-1,x(1:N))
xlabel(‘Time index n’), ylabel(‘x[n]’)
subplot(212)
stem(0: Ny -1,y(1: Ny))
xlabel(‘Time index m’), ylabel(‘y[m]’)
clear all, close all, clc
clear all, close all, clc
N = 21 ; % Length of the original sequence
n=0:N-1; % Time index
x=0.6*sin(2*pi*0.0625 *n)+0.3*sin(2*pi*0.2*n); % Original signal
L=2; % Up-sampling factor
y = upsample(x,L); % Up-sampled signal
Ny = length(y); % Length of the up-sampled signal
figure
subplot(2,1,1)
stem(0:N-1,x(1:N))
xlabel(‘Time index n’), ylabel(‘x[n]’)
axis tight
subplot(2,1,2)
stem(0:Ny-1,y(1:Ny))
xlabel(‘Time index m’), ylabel(‘y[m]’)
axis tightclear all, close all, clc
% Down-sampling
N = 41 ; % Length of the sequence
n = 0:N-1; % Time index
x = 0.6*sin(2*pi*0.0625 *n)+0.3*sin(2*pi*0.2*n); % Original signal
M = 2; % Down-sampling factor
y = x(1:M:N); % Down-sampled signal
Ny = length(y); % Length of the down-sampled sequence
figure
subplot(211),
stem(0:N-1,x(1:N))
xlabel(‘Time index n’), ylabel(‘x[n]’)
subplot(212)
stem(0: Ny -1,y(1: Ny))
xlabel(‘Time index m’), ylabel(‘y[m]’)
clear all, close all, clc
clear all, close all, clc
N = 21 ; % Length of the original sequence
n=0:N-1; % Time index
x=0.6*sin(2*pi*0.0625 *n)+0.3*sin(2*pi*0.2*n); % Original signal
L=2; % Up-sampling factor
y = upsample(x,L); % Up-sampled signal
Ny = length(y); % Length of the up-sampled signal
figure
subplot(2,1,1)
stem(0:N-1,x(1:N))
xlabel(‘Time index n’), ylabel(‘x[n]’)
axis tight
subplot(2,1,2)
stem(0:Ny-1,y(1:Ny))
xlabel(‘Time index m’), ylabel(‘y[m]’)
axis tight clear all, close all, clc
% Down-sampling
N = 41 ; % Length of the sequence
n = 0:N-1; % Time index
x = 0.6*sin(2*pi*0.0625 *n)+0.3*sin(2*pi*0.2*n); % Original signal
M = 2; % Down-sampling factor
y = x(1:M:N); % Down-sampled signal
Ny = length(y); % Length of the down-sampled sequence
figure
subplot(211),
stem(0:N-1,x(1:N))
xlabel(‘Time index n’), ylabel(‘x[n]’)
subplot(212)
stem(0: Ny -1,y(1: Ny))
xlabel(‘Time index m’), ylabel(‘y[m]’)
clear all, close all, clc
clear all, close all, clc
N = 21 ; % Length of the original sequence
n=0:N-1; % Time index
x=0.6*sin(2*pi*0.0625 *n)+0.3*sin(2*pi*0.2*n); % Original signal
L=2; % Up-sampling factor
y = upsample(x,L); % Up-sampled signal
Ny = length(y); % Length of the up-sampled signal
figure
subplot(2,1,1)
stem(0:N-1,x(1:N))
xlabel(‘Time index n’), ylabel(‘x[n]’)
axis tight
subplot(2,1,2)
stem(0:Ny-1,y(1:Ny))
xlabel(‘Time index m’), ylabel(‘y[m]’)
axis tight perform decimation/down-sampling using the matlab, the following matlab code implements the up-sampli, notice that the second subplot above contains zero, the next matlab program illustrates the effects of MATLAB Answers — New Questions
Vehicle Networking Toolbox setup
I have the Vehicle Networking toolbox for MATLAB and I am trying to make it recognize a Vector CANcaseXL. I have installed the necessary drivers for the CANcaseXL. However, I cannot establish an open channel between the toolbox and the CANcase. Here is the warning message that I received in the Matlab Command window:
>> info = canHWInfo
CAN Devices Detected:
Kvaser Devices:
Virtual 1 Channel 1
To connect, use – canChannel(‘Kvaser’, ‘Virtual 1’, 1)
Virtual 1 Channel 2
To connect, use – canChannel(‘Kvaser’, ‘Virtual 1’, 2)
Use GET on the output of CANHWINFO for more information.
>> canch1 = canChannel(‘Vector’,’CANcaseXL 1′,1)
Warning: The following error was caught while executing ‘can.vector.Channel’ class destructor:
Invalid MEX-file ‘C:Program
FilesMATLABR2010bSP1toolboxvntvntmexVectorXLDriverLibrary.mexw32′: The specified
module could not be found.
I checked the C:Program FilesMATLABR2010bSP1toolboxvntvnt directory and found the right file (mexVectorXLDriverLibrary.mexw32) that needs to be there. If everything was working properly this is what I would see:
>> info = canHWInfo
CAN Devices Detected:
Vector Devices:
CANcaseXL 1 Channel 1 (SN: 24365)
To connect, use – canChannel(‘Vector’, ‘CANcaseXL 1’, 1)
CANcaseXL 1 Channel 2 (SN: 24365)
To connect, use – canChannel(‘Vector’, ‘CANcaseXL 1’, 2)
Virtual 1 Channel 1
To connect, use – canChannel(‘Vector’, ‘Virtual 1’, 1)
Virtual 1 Channel 2
To connect, use – canChannel(‘Vector’, ‘Virtual 1’, 2)
Kvaser Devices:
Virtual 1 Channel 1
To connect, use – canChannel(‘Kvaser’, ‘Virtual 1’, 1)
Virtual 1 Channel 2
To connect, use – canChannel(‘Kvaser’, ‘Virtual 1’, 2)
Use GET on the output of CANHWINFO for more information.
I called Matlab technical support and they said that this is a Vector driver setup issue. Then I called Vector and they said it was a Matlab issue, help!I have the Vehicle Networking toolbox for MATLAB and I am trying to make it recognize a Vector CANcaseXL. I have installed the necessary drivers for the CANcaseXL. However, I cannot establish an open channel between the toolbox and the CANcase. Here is the warning message that I received in the Matlab Command window:
>> info = canHWInfo
CAN Devices Detected:
Kvaser Devices:
Virtual 1 Channel 1
To connect, use – canChannel(‘Kvaser’, ‘Virtual 1’, 1)
Virtual 1 Channel 2
To connect, use – canChannel(‘Kvaser’, ‘Virtual 1’, 2)
Use GET on the output of CANHWINFO for more information.
>> canch1 = canChannel(‘Vector’,’CANcaseXL 1′,1)
Warning: The following error was caught while executing ‘can.vector.Channel’ class destructor:
Invalid MEX-file ‘C:Program
FilesMATLABR2010bSP1toolboxvntvntmexVectorXLDriverLibrary.mexw32′: The specified
module could not be found.
I checked the C:Program FilesMATLABR2010bSP1toolboxvntvnt directory and found the right file (mexVectorXLDriverLibrary.mexw32) that needs to be there. If everything was working properly this is what I would see:
>> info = canHWInfo
CAN Devices Detected:
Vector Devices:
CANcaseXL 1 Channel 1 (SN: 24365)
To connect, use – canChannel(‘Vector’, ‘CANcaseXL 1’, 1)
CANcaseXL 1 Channel 2 (SN: 24365)
To connect, use – canChannel(‘Vector’, ‘CANcaseXL 1’, 2)
Virtual 1 Channel 1
To connect, use – canChannel(‘Vector’, ‘Virtual 1’, 1)
Virtual 1 Channel 2
To connect, use – canChannel(‘Vector’, ‘Virtual 1’, 2)
Kvaser Devices:
Virtual 1 Channel 1
To connect, use – canChannel(‘Kvaser’, ‘Virtual 1’, 1)
Virtual 1 Channel 2
To connect, use – canChannel(‘Kvaser’, ‘Virtual 1’, 2)
Use GET on the output of CANHWINFO for more information.
I called Matlab technical support and they said that this is a Vector driver setup issue. Then I called Vector and they said it was a Matlab issue, help! I have the Vehicle Networking toolbox for MATLAB and I am trying to make it recognize a Vector CANcaseXL. I have installed the necessary drivers for the CANcaseXL. However, I cannot establish an open channel between the toolbox and the CANcase. Here is the warning message that I received in the Matlab Command window:
>> info = canHWInfo
CAN Devices Detected:
Kvaser Devices:
Virtual 1 Channel 1
To connect, use – canChannel(‘Kvaser’, ‘Virtual 1’, 1)
Virtual 1 Channel 2
To connect, use – canChannel(‘Kvaser’, ‘Virtual 1’, 2)
Use GET on the output of CANHWINFO for more information.
>> canch1 = canChannel(‘Vector’,’CANcaseXL 1′,1)
Warning: The following error was caught while executing ‘can.vector.Channel’ class destructor:
Invalid MEX-file ‘C:Program
FilesMATLABR2010bSP1toolboxvntvntmexVectorXLDriverLibrary.mexw32′: The specified
module could not be found.
I checked the C:Program FilesMATLABR2010bSP1toolboxvntvnt directory and found the right file (mexVectorXLDriverLibrary.mexw32) that needs to be there. If everything was working properly this is what I would see:
>> info = canHWInfo
CAN Devices Detected:
Vector Devices:
CANcaseXL 1 Channel 1 (SN: 24365)
To connect, use – canChannel(‘Vector’, ‘CANcaseXL 1’, 1)
CANcaseXL 1 Channel 2 (SN: 24365)
To connect, use – canChannel(‘Vector’, ‘CANcaseXL 1’, 2)
Virtual 1 Channel 1
To connect, use – canChannel(‘Vector’, ‘Virtual 1’, 1)
Virtual 1 Channel 2
To connect, use – canChannel(‘Vector’, ‘Virtual 1’, 2)
Kvaser Devices:
Virtual 1 Channel 1
To connect, use – canChannel(‘Kvaser’, ‘Virtual 1’, 1)
Virtual 1 Channel 2
To connect, use – canChannel(‘Kvaser’, ‘Virtual 1’, 2)
Use GET on the output of CANHWINFO for more information.
I called Matlab technical support and they said that this is a Vector driver setup issue. Then I called Vector and they said it was a Matlab issue, help! mex, vehicle network toolbox, can, usb MATLAB Answers — New Questions
Is rotation matrix for rotating a vector can take any value of angle?
o2 = [0, 0, 0]; % Origin
ain = [1, 0, 0]; % Initial vector
input_axis = [0, 0, 1]; % Axis of rotation (z-axis)
theta = deg2rad(25); % Angle of rotation in radians
% Rotation matrix function
rot_matrix = @(axis, theta) cos(theta) * eye(3) + …
sin(theta) * [0, -axis(3), axis(2); axis(3), 0, -axis(1); -axis(2), axis(1), 0] + …
(1 – cos(theta)) * (axis’ * axis);
% Compute the rotated vector
a_rotated = rot_matrix(input_axis, theta) * (ain – o2)’ + o2′;
% Transpose to row vector for display
a_rotated = a_rotated’;
bin=[3,0,2];
o4=[3,0,-2];
output_axis=[1,0,0];
% Compute the rotated vector in terms of phi
syms phi;
rot_matrix_phi = rot_matrix(output_axis, phi);
bin_o4_rotated = rot_matrix_phi * (bin – o4)’ ;
bin_o4_rotated = bin_o4_rotated’; % Transpose to row vector for display
% Display the symbolic result
disp(‘Rotated bin-o4 in terms of phi:’);
% Display the result
disp(a_rotated)
disp(bin_o4_rotated);
o4o2=o4-o2;
disp(o4o2);
coupler=(o4o2+bin_o4_rotated-a_rotated);
display(coupler);
% Define the initial rotated components of the coupler
syms phi;
coupler = subs(coupler, conj(phi), phi);
%disp(‘Coupler vector without conjugate:’);
disp(coupler);
% Parametric substitution
syms t;
cos_phi = (1 – t^2) / (1 + t^2);
sin_phi = 2 * t / (1 + t^2);
% Substitute parametric forms into coupler components
coupler_parametric = subs(coupler, [cos(phi), sin(phi)], [cos_phi, sin_phi]);
% Display the parametric coupler
disp(‘Parametric form of coupler:’);
disp(coupler_parametric);
%after this stepit is unable to solve for theta more than 91 deg or less than -91 deg
syms targetvalue % it might be 3.5 …
normsq = expand(sum(coupler_parametric.^2) – targetvalue^2);
normpoly = simplify(normsq*(t^2+1)^2);
vpa(expand(normpoly),4);
tsolve = solve(normpoly,t,’maxdegree’,4,’returnconditions’,true);
h=vpa(subs(tsolve.t,targetvalue,3.5));
%disp(h);
real_solutions = h(imag(h) == 0);
disp(‘Real roots:’);
disp(real_solutions);
% Convert real values of t to angles using angle = 2 * atan(t)
angles_rad = 2 * atan(real_solutions);
angles_deg = rad2deg(angles_rad);
% Display angles in degrees
disp(‘Angles in degrees before adjustment:’);
disp(angles_deg);
%please consider that if i take theta(in bold) more than 91 deg or less than -91 deg instead of 25 then it is not giving me the output(means angles_deg),is it the problem with my code or rotation matrix?o2 = [0, 0, 0]; % Origin
ain = [1, 0, 0]; % Initial vector
input_axis = [0, 0, 1]; % Axis of rotation (z-axis)
theta = deg2rad(25); % Angle of rotation in radians
% Rotation matrix function
rot_matrix = @(axis, theta) cos(theta) * eye(3) + …
sin(theta) * [0, -axis(3), axis(2); axis(3), 0, -axis(1); -axis(2), axis(1), 0] + …
(1 – cos(theta)) * (axis’ * axis);
% Compute the rotated vector
a_rotated = rot_matrix(input_axis, theta) * (ain – o2)’ + o2′;
% Transpose to row vector for display
a_rotated = a_rotated’;
bin=[3,0,2];
o4=[3,0,-2];
output_axis=[1,0,0];
% Compute the rotated vector in terms of phi
syms phi;
rot_matrix_phi = rot_matrix(output_axis, phi);
bin_o4_rotated = rot_matrix_phi * (bin – o4)’ ;
bin_o4_rotated = bin_o4_rotated’; % Transpose to row vector for display
% Display the symbolic result
disp(‘Rotated bin-o4 in terms of phi:’);
% Display the result
disp(a_rotated)
disp(bin_o4_rotated);
o4o2=o4-o2;
disp(o4o2);
coupler=(o4o2+bin_o4_rotated-a_rotated);
display(coupler);
% Define the initial rotated components of the coupler
syms phi;
coupler = subs(coupler, conj(phi), phi);
%disp(‘Coupler vector without conjugate:’);
disp(coupler);
% Parametric substitution
syms t;
cos_phi = (1 – t^2) / (1 + t^2);
sin_phi = 2 * t / (1 + t^2);
% Substitute parametric forms into coupler components
coupler_parametric = subs(coupler, [cos(phi), sin(phi)], [cos_phi, sin_phi]);
% Display the parametric coupler
disp(‘Parametric form of coupler:’);
disp(coupler_parametric);
%after this stepit is unable to solve for theta more than 91 deg or less than -91 deg
syms targetvalue % it might be 3.5 …
normsq = expand(sum(coupler_parametric.^2) – targetvalue^2);
normpoly = simplify(normsq*(t^2+1)^2);
vpa(expand(normpoly),4);
tsolve = solve(normpoly,t,’maxdegree’,4,’returnconditions’,true);
h=vpa(subs(tsolve.t,targetvalue,3.5));
%disp(h);
real_solutions = h(imag(h) == 0);
disp(‘Real roots:’);
disp(real_solutions);
% Convert real values of t to angles using angle = 2 * atan(t)
angles_rad = 2 * atan(real_solutions);
angles_deg = rad2deg(angles_rad);
% Display angles in degrees
disp(‘Angles in degrees before adjustment:’);
disp(angles_deg);
%please consider that if i take theta(in bold) more than 91 deg or less than -91 deg instead of 25 then it is not giving me the output(means angles_deg),is it the problem with my code or rotation matrix? o2 = [0, 0, 0]; % Origin
ain = [1, 0, 0]; % Initial vector
input_axis = [0, 0, 1]; % Axis of rotation (z-axis)
theta = deg2rad(25); % Angle of rotation in radians
% Rotation matrix function
rot_matrix = @(axis, theta) cos(theta) * eye(3) + …
sin(theta) * [0, -axis(3), axis(2); axis(3), 0, -axis(1); -axis(2), axis(1), 0] + …
(1 – cos(theta)) * (axis’ * axis);
% Compute the rotated vector
a_rotated = rot_matrix(input_axis, theta) * (ain – o2)’ + o2′;
% Transpose to row vector for display
a_rotated = a_rotated’;
bin=[3,0,2];
o4=[3,0,-2];
output_axis=[1,0,0];
% Compute the rotated vector in terms of phi
syms phi;
rot_matrix_phi = rot_matrix(output_axis, phi);
bin_o4_rotated = rot_matrix_phi * (bin – o4)’ ;
bin_o4_rotated = bin_o4_rotated’; % Transpose to row vector for display
% Display the symbolic result
disp(‘Rotated bin-o4 in terms of phi:’);
% Display the result
disp(a_rotated)
disp(bin_o4_rotated);
o4o2=o4-o2;
disp(o4o2);
coupler=(o4o2+bin_o4_rotated-a_rotated);
display(coupler);
% Define the initial rotated components of the coupler
syms phi;
coupler = subs(coupler, conj(phi), phi);
%disp(‘Coupler vector without conjugate:’);
disp(coupler);
% Parametric substitution
syms t;
cos_phi = (1 – t^2) / (1 + t^2);
sin_phi = 2 * t / (1 + t^2);
% Substitute parametric forms into coupler components
coupler_parametric = subs(coupler, [cos(phi), sin(phi)], [cos_phi, sin_phi]);
% Display the parametric coupler
disp(‘Parametric form of coupler:’);
disp(coupler_parametric);
%after this stepit is unable to solve for theta more than 91 deg or less than -91 deg
syms targetvalue % it might be 3.5 …
normsq = expand(sum(coupler_parametric.^2) – targetvalue^2);
normpoly = simplify(normsq*(t^2+1)^2);
vpa(expand(normpoly),4);
tsolve = solve(normpoly,t,’maxdegree’,4,’returnconditions’,true);
h=vpa(subs(tsolve.t,targetvalue,3.5));
%disp(h);
real_solutions = h(imag(h) == 0);
disp(‘Real roots:’);
disp(real_solutions);
% Convert real values of t to angles using angle = 2 * atan(t)
angles_rad = 2 * atan(real_solutions);
angles_deg = rad2deg(angles_rad);
% Display angles in degrees
disp(‘Angles in degrees before adjustment:’);
disp(angles_deg);
%please consider that if i take theta(in bold) more than 91 deg or less than -91 deg instead of 25 then it is not giving me the output(means angles_deg),is it the problem with my code or rotation matrix? vector, rotation MATLAB Answers — New Questions
how can I find the intersect point of 1 plot and a yline ?
x = [0 10 20 30 40 50 60 70 80 90];
y = [0 0.0328 0.2521 0.7975 1.7295 3.0213 4.5714 6.2283 7.8191 9.1752];
plot(x,y,’LineWidth’,2);
hold on
yline(5, ‘r’);
xlim([0 90]);
ylim([0 9.1752]);x = [0 10 20 30 40 50 60 70 80 90];
y = [0 0.0328 0.2521 0.7975 1.7295 3.0213 4.5714 6.2283 7.8191 9.1752];
plot(x,y,’LineWidth’,2);
hold on
yline(5, ‘r’);
xlim([0 90]);
ylim([0 9.1752]); x = [0 10 20 30 40 50 60 70 80 90];
y = [0 0.0328 0.2521 0.7975 1.7295 3.0213 4.5714 6.2283 7.8191 9.1752];
plot(x,y,’LineWidth’,2);
hold on
yline(5, ‘r’);
xlim([0 90]);
ylim([0 9.1752]); matlab, plot, plotting MATLAB Answers — New Questions
timeout on thingSpeakRead, no data read
Hello,
since some time a script is not working anymore, it is timing out. I could track down the problem to thingSpeakRead. I am reading some data to be visualized by this:
[loc_comp, timeStamps] = thingSpeakRead(readChannelID, ‘Field’, fieldID1, ‘ReadKey’, readAPIKey, DateRange=[(datetime – days(1)), datetime]);
It was working this way approx. until April and then I ignored it first. Now I’d like to use that visualization again but can’t it get it to work. If I replace the channel read by some fixed test data everything else is running as before. Just the channel read is not working …
channel id, field number and read key have not changed…
Any ideas? The Timeout=xx parameter did not help as well …
Thanks,
Jürgen
Edit:
i also tried e.g.
[loc_comp, timeStamps] = thingSpeakRead(123456, Fields=[6], ReadKey=’MySecretKey’, NumPoints=15, Timeout=60);
with the same timeout error appearing ..Hello,
since some time a script is not working anymore, it is timing out. I could track down the problem to thingSpeakRead. I am reading some data to be visualized by this:
[loc_comp, timeStamps] = thingSpeakRead(readChannelID, ‘Field’, fieldID1, ‘ReadKey’, readAPIKey, DateRange=[(datetime – days(1)), datetime]);
It was working this way approx. until April and then I ignored it first. Now I’d like to use that visualization again but can’t it get it to work. If I replace the channel read by some fixed test data everything else is running as before. Just the channel read is not working …
channel id, field number and read key have not changed…
Any ideas? The Timeout=xx parameter did not help as well …
Thanks,
Jürgen
Edit:
i also tried e.g.
[loc_comp, timeStamps] = thingSpeakRead(123456, Fields=[6], ReadKey=’MySecretKey’, NumPoints=15, Timeout=60);
with the same timeout error appearing .. Hello,
since some time a script is not working anymore, it is timing out. I could track down the problem to thingSpeakRead. I am reading some data to be visualized by this:
[loc_comp, timeStamps] = thingSpeakRead(readChannelID, ‘Field’, fieldID1, ‘ReadKey’, readAPIKey, DateRange=[(datetime – days(1)), datetime]);
It was working this way approx. until April and then I ignored it first. Now I’d like to use that visualization again but can’t it get it to work. If I replace the channel read by some fixed test data everything else is running as before. Just the channel read is not working …
channel id, field number and read key have not changed…
Any ideas? The Timeout=xx parameter did not help as well …
Thanks,
Jürgen
Edit:
i also tried e.g.
[loc_comp, timeStamps] = thingSpeakRead(123456, Fields=[6], ReadKey=’MySecretKey’, NumPoints=15, Timeout=60);
with the same timeout error appearing .. thingspeak, thingspeakread, timeout MATLAB Answers — New Questions