Tag Archives: matlab
Colo alteration image acquisition GUI
Hi to everybody,
I have a GUI which must acquire images from a web cam, and show two images in two windows.
In the first axes i show the original frame, and in the second axes, i ‘d like to show the image after a short elaboration. In this second image i got problems, only if i make it show the raw ‘shot’ (see below) i got a correct output (the same as the first window), in all the other cases (as in the one reported below) i get a reddish image in false color.Even using the img2bw conversion, the image in the second windows is in the same absurd colors..
Below i report the callback text, in the OpFn I just inizialise the acquisition. Nowhere in the code is a reference to this axes, or other instructions that could be in some way related to this.
start(handles.video1);
for j=1:200
shot=getsnapshot(handles.video1);
imshow(shot);
image(shot, ‘Parent’,handles.axes1);
R = shot(:,:,1); %to show only the red channel
image(R, ‘Parent’,handles.axes2);
end
Thak you for your help
marioHi to everybody,
I have a GUI which must acquire images from a web cam, and show two images in two windows.
In the first axes i show the original frame, and in the second axes, i ‘d like to show the image after a short elaboration. In this second image i got problems, only if i make it show the raw ‘shot’ (see below) i got a correct output (the same as the first window), in all the other cases (as in the one reported below) i get a reddish image in false color.Even using the img2bw conversion, the image in the second windows is in the same absurd colors..
Below i report the callback text, in the OpFn I just inizialise the acquisition. Nowhere in the code is a reference to this axes, or other instructions that could be in some way related to this.
start(handles.video1);
for j=1:200
shot=getsnapshot(handles.video1);
imshow(shot);
image(shot, ‘Parent’,handles.axes1);
R = shot(:,:,1); %to show only the red channel
image(R, ‘Parent’,handles.axes2);
end
Thak you for your help
mario Hi to everybody,
I have a GUI which must acquire images from a web cam, and show two images in two windows.
In the first axes i show the original frame, and in the second axes, i ‘d like to show the image after a short elaboration. In this second image i got problems, only if i make it show the raw ‘shot’ (see below) i got a correct output (the same as the first window), in all the other cases (as in the one reported below) i get a reddish image in false color.Even using the img2bw conversion, the image in the second windows is in the same absurd colors..
Below i report the callback text, in the OpFn I just inizialise the acquisition. Nowhere in the code is a reference to this axes, or other instructions that could be in some way related to this.
start(handles.video1);
for j=1:200
shot=getsnapshot(handles.video1);
imshow(shot);
image(shot, ‘Parent’,handles.axes1);
R = shot(:,:,1); %to show only the red channel
image(R, ‘Parent’,handles.axes2);
end
Thak you for your help
mario image color alteration, image acquisition, image display MATLAB Answers — New Questions
How to measure crack width
I noticed that when I reduced the minimum acceptable area the crack width decreased although the appearance of blobs in this situation, while when i increased minimum acceptable area and the blobs removed and the width increased
for example:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 10;
% Read in image and convert to gray scale.
rgbImage = imread(‘7004-46.jpg’);
I = rgb2gray(rgbImage);
subplot(2,2,1);
imshow(I);
title(‘7004-46’);
% Take histogram.
subplot(2,2,2);
histogram(I);
grid on; %to make grid line
title(‘histogram Gray image’);
% Binarize image.
threshold = 145;
xline(threshold, ‘Color’, ‘r’, ‘LineWidth’,2)
mask=I < threshold;
mask = imfill(mask, ‘holes’);
% Filter image.
se = strel(‘line’,1, 0);
filteredImage = imclose(mask, se);
subplot(2, 2, 3);
imshow(filteredImage);
title(‘closed Image’);
%%% Measure the areas to determin minAcceptableArea show the histogram of
%%% area
% props = regionprops(filteredImage, ‘Area’);
% allAreas = sort([props.Area], ‘descend’);
% histogram(allAreas)
%%Look at the histogram. What area do you think is the minimum size to be a valid crack?
minAcceptableArea =20;
mask = bwareafilt(filteredImage, [minAcceptableArea, inf]);
subplot(2, 2, 4);
imshow(mask);
%
% % Measure size of crack.
props = regionprops(mask, ‘Area’);
allAreas = [props.Area];
out=bwferet(mask)
% Measure the areas to know the area not to be considered
% props = regionprops(mask, ‘Area’);
% allAreas = sort([props.Area], ‘descend’)
% Get width = area / maximum length
averageWidths = sort(allAreas ./ out.MaxDiameter, ‘descend’);
message = sprintf(‘The average width = %.2f pixels.’, averageWidths(1));
fprintf(‘%sn’, message);
caption = sprintf(‘Binary Image of Cracks larger than %dnAverage width of largest = %.2f pixels’, minAcceptableArea, averageWidths(1));
title(caption, ‘FontSize’, fontSize, ‘Interpreter’, ‘None’);
uiwait(helpdlg(message));I noticed that when I reduced the minimum acceptable area the crack width decreased although the appearance of blobs in this situation, while when i increased minimum acceptable area and the blobs removed and the width increased
for example:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 10;
% Read in image and convert to gray scale.
rgbImage = imread(‘7004-46.jpg’);
I = rgb2gray(rgbImage);
subplot(2,2,1);
imshow(I);
title(‘7004-46’);
% Take histogram.
subplot(2,2,2);
histogram(I);
grid on; %to make grid line
title(‘histogram Gray image’);
% Binarize image.
threshold = 145;
xline(threshold, ‘Color’, ‘r’, ‘LineWidth’,2)
mask=I < threshold;
mask = imfill(mask, ‘holes’);
% Filter image.
se = strel(‘line’,1, 0);
filteredImage = imclose(mask, se);
subplot(2, 2, 3);
imshow(filteredImage);
title(‘closed Image’);
%%% Measure the areas to determin minAcceptableArea show the histogram of
%%% area
% props = regionprops(filteredImage, ‘Area’);
% allAreas = sort([props.Area], ‘descend’);
% histogram(allAreas)
%%Look at the histogram. What area do you think is the minimum size to be a valid crack?
minAcceptableArea =20;
mask = bwareafilt(filteredImage, [minAcceptableArea, inf]);
subplot(2, 2, 4);
imshow(mask);
%
% % Measure size of crack.
props = regionprops(mask, ‘Area’);
allAreas = [props.Area];
out=bwferet(mask)
% Measure the areas to know the area not to be considered
% props = regionprops(mask, ‘Area’);
% allAreas = sort([props.Area], ‘descend’)
% Get width = area / maximum length
averageWidths = sort(allAreas ./ out.MaxDiameter, ‘descend’);
message = sprintf(‘The average width = %.2f pixels.’, averageWidths(1));
fprintf(‘%sn’, message);
caption = sprintf(‘Binary Image of Cracks larger than %dnAverage width of largest = %.2f pixels’, minAcceptableArea, averageWidths(1));
title(caption, ‘FontSize’, fontSize, ‘Interpreter’, ‘None’);
uiwait(helpdlg(message)); I noticed that when I reduced the minimum acceptable area the crack width decreased although the appearance of blobs in this situation, while when i increased minimum acceptable area and the blobs removed and the width increased
for example:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 10;
% Read in image and convert to gray scale.
rgbImage = imread(‘7004-46.jpg’);
I = rgb2gray(rgbImage);
subplot(2,2,1);
imshow(I);
title(‘7004-46’);
% Take histogram.
subplot(2,2,2);
histogram(I);
grid on; %to make grid line
title(‘histogram Gray image’);
% Binarize image.
threshold = 145;
xline(threshold, ‘Color’, ‘r’, ‘LineWidth’,2)
mask=I < threshold;
mask = imfill(mask, ‘holes’);
% Filter image.
se = strel(‘line’,1, 0);
filteredImage = imclose(mask, se);
subplot(2, 2, 3);
imshow(filteredImage);
title(‘closed Image’);
%%% Measure the areas to determin minAcceptableArea show the histogram of
%%% area
% props = regionprops(filteredImage, ‘Area’);
% allAreas = sort([props.Area], ‘descend’);
% histogram(allAreas)
%%Look at the histogram. What area do you think is the minimum size to be a valid crack?
minAcceptableArea =20;
mask = bwareafilt(filteredImage, [minAcceptableArea, inf]);
subplot(2, 2, 4);
imshow(mask);
%
% % Measure size of crack.
props = regionprops(mask, ‘Area’);
allAreas = [props.Area];
out=bwferet(mask)
% Measure the areas to know the area not to be considered
% props = regionprops(mask, ‘Area’);
% allAreas = sort([props.Area], ‘descend’)
% Get width = area / maximum length
averageWidths = sort(allAreas ./ out.MaxDiameter, ‘descend’);
message = sprintf(‘The average width = %.2f pixels.’, averageWidths(1));
fprintf(‘%sn’, message);
caption = sprintf(‘Binary Image of Cracks larger than %dnAverage width of largest = %.2f pixels’, minAcceptableArea, averageWidths(1));
title(caption, ‘FontSize’, fontSize, ‘Interpreter’, ‘None’);
uiwait(helpdlg(message)); image analysis, image processing, image segmentation, crack, concrete, width, measures MATLAB Answers — New Questions
Caucer fraction expansion fraction expansion for filter synthesis
2s^2+2s+1|2s^3 +2s^2 +2s+1 | s
2s^3+2s^2+s
——————————————————-
s+1|2s^2+2s+1| 2s
So want to know how to pereform Caucer fraction expansion fraction expansion for filter synthesis. For a N/M polynomial. so i get a constant*s mainly not s+1,or s-1 which residue gives sometimes2s^2+2s+1|2s^3 +2s^2 +2s+1 | s
2s^3+2s^2+s
——————————————————-
s+1|2s^2+2s+1| 2s
So want to know how to pereform Caucer fraction expansion fraction expansion for filter synthesis. For a N/M polynomial. so i get a constant*s mainly not s+1,or s-1 which residue gives sometimes 2s^2+2s+1|2s^3 +2s^2 +2s+1 | s
2s^3+2s^2+s
——————————————————-
s+1|2s^2+2s+1| 2s
So want to know how to pereform Caucer fraction expansion fraction expansion for filter synthesis. For a N/M polynomial. so i get a constant*s mainly not s+1,or s-1 which residue gives sometimes fraction expansion, caucer fraction expansion, filter design MATLAB Answers — New Questions
For loop for different step size
Dear Matlab Community,
I have a matrix like
[24 80; 24 80; 24 80; 24 80; 30 120; 30 120; 48 124; 48 124; 48 124]
I need to have a plot that 80, 120, 124 be in the x axis and the numbers 4,2,3 be in the y axis.
We have 4 of 24, 3 of 30 and 3 of 48.
Thanks :)))Dear Matlab Community,
I have a matrix like
[24 80; 24 80; 24 80; 24 80; 30 120; 30 120; 48 124; 48 124; 48 124]
I need to have a plot that 80, 120, 124 be in the x axis and the numbers 4,2,3 be in the y axis.
We have 4 of 24, 3 of 30 and 3 of 48.
Thanks :))) Dear Matlab Community,
I have a matrix like
[24 80; 24 80; 24 80; 24 80; 30 120; 30 120; 48 124; 48 124; 48 124]
I need to have a plot that 80, 120, 124 be in the x axis and the numbers 4,2,3 be in the y axis.
We have 4 of 24, 3 of 30 and 3 of 48.
Thanks :))) matrix, loop MATLAB Answers — New Questions
How to display figure on a specific monitor when there are multiple screens
I use a computer with multiple screens. I would like to have my new figures spawn on a screen that I specify instead of the main display screen. It would be wonderful if MATLAB could detect the number of displays connected, and let me pass the display number to "figure". If the display vanishes during the execution, fall back to alternate displays.
It would be nice to have a method where I did not have to compute the pixels. If the code executes after a monitor gets disconnected the figure is out of the viewable screen.I use a computer with multiple screens. I would like to have my new figures spawn on a screen that I specify instead of the main display screen. It would be wonderful if MATLAB could detect the number of displays connected, and let me pass the display number to "figure". If the display vanishes during the execution, fall back to alternate displays.
It would be nice to have a method where I did not have to compute the pixels. If the code executes after a monitor gets disconnected the figure is out of the viewable screen. I use a computer with multiple screens. I would like to have my new figures spawn on a screen that I specify instead of the main display screen. It would be wonderful if MATLAB could detect the number of displays connected, and let me pass the display number to "figure". If the display vanishes during the execution, fall back to alternate displays.
It would be nice to have a method where I did not have to compute the pixels. If the code executes after a monitor gets disconnected the figure is out of the viewable screen. monitorpositions, defaultfigureposition, defaultpropertyvalues MATLAB Answers — New Questions
Display Image to a specific Monitor
Hello,
Here’s my screen set up:
If I want to show an image(using imtool or imageViewer) to a specific Display monitor (3 for example), what parameter to use? Can we do that?Hello,
Here’s my screen set up:
If I want to show an image(using imtool or imageViewer) to a specific Display monitor (3 for example), what parameter to use? Can we do that? Hello,
Here’s my screen set up:
If I want to show an image(using imtool or imageViewer) to a specific Display monitor (3 for example), what parameter to use? Can we do that? image display parameter MATLAB Answers — New Questions
Lowpass filter not making any difference
I’m new to filtering, trying to use a low-pass filter to filter a sine wave with another high frequency sine wave on top of it. Using highpass(valArray, .03) I can effectively isolate the higher frrequency. But lowpass(valArray, .03) just appears to return the original signal (or something close to it).
It’s possible my setup is incomplete. I’m simply using the lowpass() and highpass() commands. But seems odd that the highpass filter works fine while the lowpass filter fails.
lowpass(valArray, .03);
highpass(valArray, .03)I’m new to filtering, trying to use a low-pass filter to filter a sine wave with another high frequency sine wave on top of it. Using highpass(valArray, .03) I can effectively isolate the higher frrequency. But lowpass(valArray, .03) just appears to return the original signal (or something close to it).
It’s possible my setup is incomplete. I’m simply using the lowpass() and highpass() commands. But seems odd that the highpass filter works fine while the lowpass filter fails.
lowpass(valArray, .03);
highpass(valArray, .03) I’m new to filtering, trying to use a low-pass filter to filter a sine wave with another high frequency sine wave on top of it. Using highpass(valArray, .03) I can effectively isolate the higher frrequency. But lowpass(valArray, .03) just appears to return the original signal (or something close to it).
It’s possible my setup is incomplete. I’m simply using the lowpass() and highpass() commands. But seems odd that the highpass filter works fine while the lowpass filter fails.
lowpass(valArray, .03);
highpass(valArray, .03) filtering, lowpass, highpass MATLAB Answers — New Questions
MATLAB says in Command Window, “Cannot acquire a MATLAB licence…”
Every so often while MATLAB is open, the command window delivers the below text:
"Cannot acquire a MATLAB license.
There will be X more attempt(s) to acquire a license before the application exits.
Save any work now."
I have been closing and restarting MATLAB before it exits by itself to keep that on my own terms, however would like for it to be able to validate my licence. I have a student licence, and am logged in at the top right corner of the application. I was having problems some time ago and attempted to delete and reinstall the licence manager. This helped those problems but now I have this issue.
I already tried installing a new version to see if that would help (was on 2023a), so I installed version 2023b. The problem persists. Any help would be greatly appreciated, thank you.Every so often while MATLAB is open, the command window delivers the below text:
"Cannot acquire a MATLAB license.
There will be X more attempt(s) to acquire a license before the application exits.
Save any work now."
I have been closing and restarting MATLAB before it exits by itself to keep that on my own terms, however would like for it to be able to validate my licence. I have a student licence, and am logged in at the top right corner of the application. I was having problems some time ago and attempted to delete and reinstall the licence manager. This helped those problems but now I have this issue.
I already tried installing a new version to see if that would help (was on 2023a), so I installed version 2023b. The problem persists. Any help would be greatly appreciated, thank you. Every so often while MATLAB is open, the command window delivers the below text:
"Cannot acquire a MATLAB license.
There will be X more attempt(s) to acquire a license before the application exits.
Save any work now."
I have been closing and restarting MATLAB before it exits by itself to keep that on my own terms, however would like for it to be able to validate my licence. I have a student licence, and am logged in at the top right corner of the application. I was having problems some time ago and attempted to delete and reinstall the licence manager. This helped those problems but now I have this issue.
I already tried installing a new version to see if that would help (was on 2023a), so I installed version 2023b. The problem persists. Any help would be greatly appreciated, thank you. license MATLAB Answers — New Questions
Need to make graph from Multiple Simscape Runs
I am running a simulation of a pilot operated hydraulic valve built on simscape down to the component level.
I want to make a single graph of pressure drop vs flow across various different pilot valve restrictions, something like below, where each colour is a different run in simscape:
I am not the most experienced with Matlab coding, I have tried to export results to an Excel then manually make them from there but I would Ideally like to do this all within MatlabI am running a simulation of a pilot operated hydraulic valve built on simscape down to the component level.
I want to make a single graph of pressure drop vs flow across various different pilot valve restrictions, something like below, where each colour is a different run in simscape:
I am not the most experienced with Matlab coding, I have tried to export results to an Excel then manually make them from there but I would Ideally like to do this all within Matlab I am running a simulation of a pilot operated hydraulic valve built on simscape down to the component level.
I want to make a single graph of pressure drop vs flow across various different pilot valve restrictions, something like below, where each colour is a different run in simscape:
I am not the most experienced with Matlab coding, I have tried to export results to an Excel then manually make them from there but I would Ideally like to do this all within Matlab simscape, graph, simscape graphing, valves, hydraulics MATLAB Answers — New Questions
How to use observational weights in fitrgp?
Is there a way to introduce observational weights in the Gaussian Process Regression (fitrgp) routine? This seems to be possible for other machine learning methods such as fitrensemble.Is there a way to introduce observational weights in the Gaussian Process Regression (fitrgp) routine? This seems to be possible for other machine learning methods such as fitrensemble. Is there a way to introduce observational weights in the Gaussian Process Regression (fitrgp) routine? This seems to be possible for other machine learning methods such as fitrensemble. fitrgp MATLAB Answers — New Questions
Intel ARC graphics device and MATLAB
Not really a question but I would like to report many issues withh App Designer and its stand alone version when using with Intel ARC graphics device.
We have developped the stand alone apps, for many years, and it works fine with PC equipped with Nvidia graphics card and possibly Intel XE graphics card.
But we just get a new PC with Intel ARC graphics and here we start to have many many issues.
The "Design view" Canvas of the GUI in App Deigner is somewhat collapses when running under MATLAB: the components has different positions within the UIFigure, It looks like the pixels unit of different components are not somehow respected.
Worse when the app is deployed as stand alone app using MCC command, the deployed app behave differently under MATLAB. With the latest Intel ARC graphic driver installed, the app cimply crashed without any warning of error message – for example the simple command rendererinfo will crash. I have to install some older driver, then it is not crahes but I notice odd think like icon on push buttons do not displayed at all (the button is blank). Horrible.
Never have such issues with Nvidia drivers. Not sure who I should report the problem (my PC vendor, ASUS; or Intel or TMW) Regardless I just warn those who want to buy a new PC to work with MATLAB. Avoid Intel ARC gradphics card and save you some frustration.Not really a question but I would like to report many issues withh App Designer and its stand alone version when using with Intel ARC graphics device.
We have developped the stand alone apps, for many years, and it works fine with PC equipped with Nvidia graphics card and possibly Intel XE graphics card.
But we just get a new PC with Intel ARC graphics and here we start to have many many issues.
The "Design view" Canvas of the GUI in App Deigner is somewhat collapses when running under MATLAB: the components has different positions within the UIFigure, It looks like the pixels unit of different components are not somehow respected.
Worse when the app is deployed as stand alone app using MCC command, the deployed app behave differently under MATLAB. With the latest Intel ARC graphic driver installed, the app cimply crashed without any warning of error message – for example the simple command rendererinfo will crash. I have to install some older driver, then it is not crahes but I notice odd think like icon on push buttons do not displayed at all (the button is blank). Horrible.
Never have such issues with Nvidia drivers. Not sure who I should report the problem (my PC vendor, ASUS; or Intel or TMW) Regardless I just warn those who want to buy a new PC to work with MATLAB. Avoid Intel ARC gradphics card and save you some frustration. Not really a question but I would like to report many issues withh App Designer and its stand alone version when using with Intel ARC graphics device.
We have developped the stand alone apps, for many years, and it works fine with PC equipped with Nvidia graphics card and possibly Intel XE graphics card.
But we just get a new PC with Intel ARC graphics and here we start to have many many issues.
The "Design view" Canvas of the GUI in App Deigner is somewhat collapses when running under MATLAB: the components has different positions within the UIFigure, It looks like the pixels unit of different components are not somehow respected.
Worse when the app is deployed as stand alone app using MCC command, the deployed app behave differently under MATLAB. With the latest Intel ARC graphic driver installed, the app cimply crashed without any warning of error message – for example the simple command rendererinfo will crash. I have to install some older driver, then it is not crahes but I notice odd think like icon on push buttons do not displayed at all (the button is blank). Horrible.
Never have such issues with Nvidia drivers. Not sure who I should report the problem (my PC vendor, ASUS; or Intel or TMW) Regardless I just warn those who want to buy a new PC to work with MATLAB. Avoid Intel ARC gradphics card and save you some frustration. appdesigner, graphic card, standalone app MATLAB Answers — New Questions
Error in Simulink – Derivative of state ‘1’ in block at time 301.02267725 is not finite. The simulation will be stopped. There may be a singularity in the solution.
I get the following error –
An error occurred while running the simulation and the simulation was terminated
Caused by:
Derivative of state ‘1’ in block ‘gam_control1/PID Controller2/Integrator/Continuous/Integrator’ at time 301.02267725611046 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
I am using a manually created signal (using signal editor) as an input into a PID controller. I have tried to select ODE15 from the model configurations and also tried tightening the absolute error. Nothing works. The simulation stops at 300 s. I need it to run till 550 s. Please help.I get the following error –
An error occurred while running the simulation and the simulation was terminated
Caused by:
Derivative of state ‘1’ in block ‘gam_control1/PID Controller2/Integrator/Continuous/Integrator’ at time 301.02267725611046 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
I am using a manually created signal (using signal editor) as an input into a PID controller. I have tried to select ODE15 from the model configurations and also tried tightening the absolute error. Nothing works. The simulation stops at 300 s. I need it to run till 550 s. Please help. I get the following error –
An error occurred while running the simulation and the simulation was terminated
Caused by:
Derivative of state ‘1’ in block ‘gam_control1/PID Controller2/Integrator/Continuous/Integrator’ at time 301.02267725611046 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
I am using a manually created signal (using signal editor) as an input into a PID controller. I have tried to select ODE15 from the model configurations and also tried tightening the absolute error. Nothing works. The simulation stops at 300 s. I need it to run till 550 s. Please help. simulink, error MATLAB Answers — New Questions
Why is my code lines panel so wide?
I think I accidentially clicked on something that enlarged it one time and now it won’t go back.I think I accidentially clicked on something that enlarged it one time and now it won’t go back. I think I accidentially clicked on something that enlarged it one time and now it won’t go back. visual MATLAB Answers — New Questions
Polar Label Type Contour
I have 3 types of data. The first data is the angle, the second data is the radial distance, the third data is the pre-calculated data as a function of the first two data.
precomputed data
angle=[a1;a2;a3…];
radial =[r1;r2;r3..];
value=[var1;var2;var3…];
I tried this but ı didnt good result i think i’m wrong: The z values must be a value in the x and y coordinates, not a function of x and y.
for example
angle = [0 36 72 108 144 180 216 252 288 324 360];
radial = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1];
value=[0.1;0.2;………..];
[a,r] = meshgrid(angle,radial);
[x,y] = pol2cart(a,r);
value = [var1;var2;var3…];; %must be located in x y coordinates
contourf(X,Y,Z,’ShowText’,’on’)
daspect([1 1 1])
How can I obtain the circular contour distribution that indicates the position of the data calculated with the angle and distance data according to the angle and radial distance and writes (for example c label type) the value as a number?
I am sharing the similar graph that I want to achieve in the attachment.I have 3 types of data. The first data is the angle, the second data is the radial distance, the third data is the pre-calculated data as a function of the first two data.
precomputed data
angle=[a1;a2;a3…];
radial =[r1;r2;r3..];
value=[var1;var2;var3…];
I tried this but ı didnt good result i think i’m wrong: The z values must be a value in the x and y coordinates, not a function of x and y.
for example
angle = [0 36 72 108 144 180 216 252 288 324 360];
radial = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1];
value=[0.1;0.2;………..];
[a,r] = meshgrid(angle,radial);
[x,y] = pol2cart(a,r);
value = [var1;var2;var3…];; %must be located in x y coordinates
contourf(X,Y,Z,’ShowText’,’on’)
daspect([1 1 1])
How can I obtain the circular contour distribution that indicates the position of the data calculated with the angle and distance data according to the angle and radial distance and writes (for example c label type) the value as a number?
I am sharing the similar graph that I want to achieve in the attachment. I have 3 types of data. The first data is the angle, the second data is the radial distance, the third data is the pre-calculated data as a function of the first two data.
precomputed data
angle=[a1;a2;a3…];
radial =[r1;r2;r3..];
value=[var1;var2;var3…];
I tried this but ı didnt good result i think i’m wrong: The z values must be a value in the x and y coordinates, not a function of x and y.
for example
angle = [0 36 72 108 144 180 216 252 288 324 360];
radial = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1];
value=[0.1;0.2;………..];
[a,r] = meshgrid(angle,radial);
[x,y] = pol2cart(a,r);
value = [var1;var2;var3…];; %must be located in x y coordinates
contourf(X,Y,Z,’ShowText’,’on’)
daspect([1 1 1])
How can I obtain the circular contour distribution that indicates the position of the data calculated with the angle and distance data according to the angle and radial distance and writes (for example c label type) the value as a number?
I am sharing the similar graph that I want to achieve in the attachment. c label, polar graph, polar, contour, graph, plot, contour ploth MATLAB Answers — New Questions
MCC PCI-DAS on 64-bit Matlab Simulink real-time
In the past we have successfully used Measurement Computing PCI-DAS 1001/2, PCI-DAS 1200 and PCI-QUAD boards with Matlab xPC Target for real-time acquisition for custom robotic applications. The drivers for Measurement Computing boards were supported only until Matlab 2015b, since this was the last version of Matlab that was 32 bit. After that measurement computing boards (at least the ones that we have) are no longer supported. On one of our older industrial PCs have died and the new one does not run 32 bit version of xPC Target. So the next step would be to try to compile 32 bit drivers on a 64 bit version of Matlab.
Has anybody tried to compile drivers for Measurement Computing boards on 64 bit Matlab and used them in Simulink real-time (which is basically just renamed xPC Target)?
I am trying to port model from Matlab 2014a xPC Target to Matlab 2019b Simulink real-time.In the past we have successfully used Measurement Computing PCI-DAS 1001/2, PCI-DAS 1200 and PCI-QUAD boards with Matlab xPC Target for real-time acquisition for custom robotic applications. The drivers for Measurement Computing boards were supported only until Matlab 2015b, since this was the last version of Matlab that was 32 bit. After that measurement computing boards (at least the ones that we have) are no longer supported. On one of our older industrial PCs have died and the new one does not run 32 bit version of xPC Target. So the next step would be to try to compile 32 bit drivers on a 64 bit version of Matlab.
Has anybody tried to compile drivers for Measurement Computing boards on 64 bit Matlab and used them in Simulink real-time (which is basically just renamed xPC Target)?
I am trying to port model from Matlab 2014a xPC Target to Matlab 2019b Simulink real-time. In the past we have successfully used Measurement Computing PCI-DAS 1001/2, PCI-DAS 1200 and PCI-QUAD boards with Matlab xPC Target for real-time acquisition for custom robotic applications. The drivers for Measurement Computing boards were supported only until Matlab 2015b, since this was the last version of Matlab that was 32 bit. After that measurement computing boards (at least the ones that we have) are no longer supported. On one of our older industrial PCs have died and the new one does not run 32 bit version of xPC Target. So the next step would be to try to compile 32 bit drivers on a 64 bit version of Matlab.
Has anybody tried to compile drivers for Measurement Computing boards on 64 bit Matlab and used them in Simulink real-time (which is basically just renamed xPC Target)?
I am trying to port model from Matlab 2014a xPC Target to Matlab 2019b Simulink real-time. mmc pci-das, xpc target, simulink real-time MATLAB Answers — New Questions
viewSolid.m and viewSolidone.m where to get?
to visualize triple and double integrals.to visualize triple and double integrals. to visualize triple and double integrals. viewsolid, viewsolidone MATLAB Answers — New Questions
how to plot a graph of this equation?
Y=1/x^2+8Y=1/x^2+8 Y=1/x^2+8 y=1/x^2+8 MATLAB Answers — New Questions
Trouble using ODE45 for coupled non-linear differential equation
Hi,
I am attempting to model the back filling of a large vacuum vessel with Nitrogen. The flow of the Nitrogen is controlled by the valve with a certain valve flow coefficient. P2 is constant and approximately one atmosphere. I have derivived the following equations to model this.
So I wrote the following code with ODE45 to monitor the pressure over time.
% IC Vector
IC_BF = [P01, Q0, dP0, dQ0];
t = [0 10];
options = odeset(‘RelTol’,1e-12 );
[t_ode45,Result] = ode45(@BF_dyn, t, IC_BF, options)
function result = BF_dyn(t, x)
% Constants
delta_P0 = 6894.76; % Pa
P01 = 1.33322e-5; % pa
dP01 =0; % Pa
R = 8.314; % J / mol·K
C_v = 0.28*(6.309e-5/1); % (gallons/min) ( 6.309e-5 (m^3/s)/ 1 (gallons/min)) = m^3/s
Tamb = 293; % K
G = 0.967;
dewar_vol = 4.4; % m^3
rho_N2 = 1.25; %kg/m^3
M_N2 = 28.02*(1/1000); % g/mol * (1 kg/1000g) = kg/mol
P02 = 6894.76; % Pa
b = (sqrt(G)/(C_v))^2;
a = rho_N2*R*Tamb/(M_N2*dewar_vol);
result = [
-2*x(2)*x(4)*b;
(1/a)*x(4);
x(3);
x(4);
];
end
However, when I plot the results I get the following, which goes significantly higher than P2 before attempting to go negative when in reality it should asymptote out to P2.
Am I implement this system into ODE45 wrong? Is there any way to incorporate the realtionship between P1 and P2 into ODE45 by adding additional arguement to my results vector?
Thank you for any assistance you can offer!Hi,
I am attempting to model the back filling of a large vacuum vessel with Nitrogen. The flow of the Nitrogen is controlled by the valve with a certain valve flow coefficient. P2 is constant and approximately one atmosphere. I have derivived the following equations to model this.
So I wrote the following code with ODE45 to monitor the pressure over time.
% IC Vector
IC_BF = [P01, Q0, dP0, dQ0];
t = [0 10];
options = odeset(‘RelTol’,1e-12 );
[t_ode45,Result] = ode45(@BF_dyn, t, IC_BF, options)
function result = BF_dyn(t, x)
% Constants
delta_P0 = 6894.76; % Pa
P01 = 1.33322e-5; % pa
dP01 =0; % Pa
R = 8.314; % J / mol·K
C_v = 0.28*(6.309e-5/1); % (gallons/min) ( 6.309e-5 (m^3/s)/ 1 (gallons/min)) = m^3/s
Tamb = 293; % K
G = 0.967;
dewar_vol = 4.4; % m^3
rho_N2 = 1.25; %kg/m^3
M_N2 = 28.02*(1/1000); % g/mol * (1 kg/1000g) = kg/mol
P02 = 6894.76; % Pa
b = (sqrt(G)/(C_v))^2;
a = rho_N2*R*Tamb/(M_N2*dewar_vol);
result = [
-2*x(2)*x(4)*b;
(1/a)*x(4);
x(3);
x(4);
];
end
However, when I plot the results I get the following, which goes significantly higher than P2 before attempting to go negative when in reality it should asymptote out to P2.
Am I implement this system into ODE45 wrong? Is there any way to incorporate the realtionship between P1 and P2 into ODE45 by adding additional arguement to my results vector?
Thank you for any assistance you can offer! Hi,
I am attempting to model the back filling of a large vacuum vessel with Nitrogen. The flow of the Nitrogen is controlled by the valve with a certain valve flow coefficient. P2 is constant and approximately one atmosphere. I have derivived the following equations to model this.
So I wrote the following code with ODE45 to monitor the pressure over time.
% IC Vector
IC_BF = [P01, Q0, dP0, dQ0];
t = [0 10];
options = odeset(‘RelTol’,1e-12 );
[t_ode45,Result] = ode45(@BF_dyn, t, IC_BF, options)
function result = BF_dyn(t, x)
% Constants
delta_P0 = 6894.76; % Pa
P01 = 1.33322e-5; % pa
dP01 =0; % Pa
R = 8.314; % J / mol·K
C_v = 0.28*(6.309e-5/1); % (gallons/min) ( 6.309e-5 (m^3/s)/ 1 (gallons/min)) = m^3/s
Tamb = 293; % K
G = 0.967;
dewar_vol = 4.4; % m^3
rho_N2 = 1.25; %kg/m^3
M_N2 = 28.02*(1/1000); % g/mol * (1 kg/1000g) = kg/mol
P02 = 6894.76; % Pa
b = (sqrt(G)/(C_v))^2;
a = rho_N2*R*Tamb/(M_N2*dewar_vol);
result = [
-2*x(2)*x(4)*b;
(1/a)*x(4);
x(3);
x(4);
];
end
However, when I plot the results I get the following, which goes significantly higher than P2 before attempting to go negative when in reality it should asymptote out to P2.
Am I implement this system into ODE45 wrong? Is there any way to incorporate the realtionship between P1 and P2 into ODE45 by adding additional arguement to my results vector?
Thank you for any assistance you can offer! ode45 MATLAB Answers — New Questions
loss, the classification error
I’m using the "loss" function when I calculate a classification error.
Below is a confusion matrix that has one mis classification.
In abvoe case, I think the loss should be 1/7*100 = 14.3 %.
But the "loss" function shows 15.9 %.
It seems the "loss"’ function has a special logic to calculate loss.
So, I’d like to know what it is. And, if possible, have loss value same as 14.3 % by modifying option in "loss" function.I’m using the "loss" function when I calculate a classification error.
Below is a confusion matrix that has one mis classification.
In abvoe case, I think the loss should be 1/7*100 = 14.3 %.
But the "loss" function shows 15.9 %.
It seems the "loss"’ function has a special logic to calculate loss.
So, I’d like to know what it is. And, if possible, have loss value same as 14.3 % by modifying option in "loss" function. I’m using the "loss" function when I calculate a classification error.
Below is a confusion matrix that has one mis classification.
In abvoe case, I think the loss should be 1/7*100 = 14.3 %.
But the "loss" function shows 15.9 %.
It seems the "loss"’ function has a special logic to calculate loss.
So, I’d like to know what it is. And, if possible, have loss value same as 14.3 % by modifying option in "loss" function. loss classification error MATLAB Answers — New Questions
volumeViewer Display Parameter Adjustment?
Hello,
here’s my 2D image Display (1 slice of 3D data) using imtool:
If I display the 3D file using volumeViewer, it looks like this:
How to make the gray square to be black like the rest of the background in the 3D volumeViewer? Is there a parameter I can use or adjust in volumeViewer function?
Thank you!Hello,
here’s my 2D image Display (1 slice of 3D data) using imtool:
If I display the 3D file using volumeViewer, it looks like this:
How to make the gray square to be black like the rest of the background in the 3D volumeViewer? Is there a parameter I can use or adjust in volumeViewer function?
Thank you! Hello,
here’s my 2D image Display (1 slice of 3D data) using imtool:
If I display the 3D file using volumeViewer, it looks like this:
How to make the gray square to be black like the rest of the background in the 3D volumeViewer? Is there a parameter I can use or adjust in volumeViewer function?
Thank you! volumeviewer MATLAB Answers — New Questions