Category: Matlab
Category Archives: Matlab
i have a txt file with ‘temp’ and ‘heat flux’ and i need to use it to calculate final temp and optimum emissivity. my code runs fine but the output file is coming out blank?
C1 = 3.74177e8;
C2 = 1.43878e4;
sig = 5.67e-8;
T_static = 229.58;
Tval = fopen(‘radiative boundary.txt’, ‘r’);
Tvalue = fscanf(Tval, ‘%f’);
fclose(Tval);
T = Tvalue;
H = hvalue;
Temp_value = [];
optimum_emsvty = [];
Temp_value = Temp_value;
optimum_emsvty = optimum_emsvty;
for i = 1:length(H)
e0 = 0.0;
e1 = 1.0;
delt = 1;
while abs(delt) > 0.000001
e = (e0 + e1) / 2.0;
c = 500;
for j = 1:5
c = c – wall(c, i, T, H, e, sig, T_static) / derivative(@wall, c, 1e-6, i, T, H, e, sig, T_static);
end
powr = integral(@(lam) power(lam, C1, C2, e), 8, 12);
delt = powr – integral(@(lam) power(lam, C1, C2, 1), 8, 12);
if delt > 0
e1 = e;
elseif delt < 0
e0 = e;
end
end
c = double(c);
end
writematrix(optimum_emsvty,’Optimum_Emissivity.txt’);
writematrix(Temp_value,’Final_Wall_Temperature.txt’);
function powr = power(lam, C1, C2, e)
powr = (e * C1) / ((lam^5) * (exp(C2 / (lam * T_static)) – 1));
endC1 = 3.74177e8;
C2 = 1.43878e4;
sig = 5.67e-8;
T_static = 229.58;
Tval = fopen(‘radiative boundary.txt’, ‘r’);
Tvalue = fscanf(Tval, ‘%f’);
fclose(Tval);
T = Tvalue;
H = hvalue;
Temp_value = [];
optimum_emsvty = [];
Temp_value = Temp_value;
optimum_emsvty = optimum_emsvty;
for i = 1:length(H)
e0 = 0.0;
e1 = 1.0;
delt = 1;
while abs(delt) > 0.000001
e = (e0 + e1) / 2.0;
c = 500;
for j = 1:5
c = c – wall(c, i, T, H, e, sig, T_static) / derivative(@wall, c, 1e-6, i, T, H, e, sig, T_static);
end
powr = integral(@(lam) power(lam, C1, C2, e), 8, 12);
delt = powr – integral(@(lam) power(lam, C1, C2, 1), 8, 12);
if delt > 0
e1 = e;
elseif delt < 0
e0 = e;
end
end
c = double(c);
end
writematrix(optimum_emsvty,’Optimum_Emissivity.txt’);
writematrix(Temp_value,’Final_Wall_Temperature.txt’);
function powr = power(lam, C1, C2, e)
powr = (e * C1) / ((lam^5) * (exp(C2 / (lam * T_static)) – 1));
end C1 = 3.74177e8;
C2 = 1.43878e4;
sig = 5.67e-8;
T_static = 229.58;
Tval = fopen(‘radiative boundary.txt’, ‘r’);
Tvalue = fscanf(Tval, ‘%f’);
fclose(Tval);
T = Tvalue;
H = hvalue;
Temp_value = [];
optimum_emsvty = [];
Temp_value = Temp_value;
optimum_emsvty = optimum_emsvty;
for i = 1:length(H)
e0 = 0.0;
e1 = 1.0;
delt = 1;
while abs(delt) > 0.000001
e = (e0 + e1) / 2.0;
c = 500;
for j = 1:5
c = c – wall(c, i, T, H, e, sig, T_static) / derivative(@wall, c, 1e-6, i, T, H, e, sig, T_static);
end
powr = integral(@(lam) power(lam, C1, C2, e), 8, 12);
delt = powr – integral(@(lam) power(lam, C1, C2, 1), 8, 12);
if delt > 0
e1 = e;
elseif delt < 0
e0 = e;
end
end
c = double(c);
end
writematrix(optimum_emsvty,’Optimum_Emissivity.txt’);
writematrix(Temp_value,’Final_Wall_Temperature.txt’);
function powr = power(lam, C1, C2, e)
powr = (e * C1) / ((lam^5) * (exp(C2 / (lam * T_static)) – 1));
end output file blank MATLAB Answers — New Questions
error
Finding keypoints…
3809 keypoints found.
Warning: Function D:siftDemoV4image.m has the same name as a MATLAB builtin. We
suggest you rename the function to avoid a potential name conflict.
> In sift at 48
In abcd at 2
Drawing SIFT keypoints …
??? Error using ==> image
Too many input arguments.
Error in ==> imagesc at 19
hh = image(varargin{1},’CDataMapping’,’scaled’);
Error in ==> showkeys at 16
imagesc(image);
Error in ==> abcd at 3
showkeys(im1,loc1);
I AM GETTING THESE ERRORS WHILE RUNNING THE FOLLOWING MATLAB CODE
function num=match(im1,im2)
[im1,des1,loc1]=sift(‘mm.pgm’);
showkeys(im1,loc1);
[im2,des2,loc2]=sift(‘nn.pgm’);
showkeys(im2,loc2);
distRatio=0.6;
des2t =des2′;
for i = 1 : size(des1,1)
dotprods = des1(i,:) * des2t;
[vals,indx] = sort(acos(dotprods));
if (vals(1) < distRatio * vals(2))
match(i) = indx(1);
else
match(i) = 0;
end
end
im3 = appendimages(im1,im2);
figure(‘Position’, [100 100 size(im3,2) size(im3,1)]);
colormap(‘gray’);
imagesc(im3);
hold on;
cols1 = size(im1,2);
for i = 1: size(des1,1)
if (match(i) > 0)
line([loc1(i,2) loc2(match(i),2)+cols1], …
[loc1(i,1) loc2(match(i),1)], ‘Color’, ‘c’);
end
end
hold off
num = sum(match >0);
fprintf(‘Found %d matches.n’, num);
HELP ME PLEASEFinding keypoints…
3809 keypoints found.
Warning: Function D:siftDemoV4image.m has the same name as a MATLAB builtin. We
suggest you rename the function to avoid a potential name conflict.
> In sift at 48
In abcd at 2
Drawing SIFT keypoints …
??? Error using ==> image
Too many input arguments.
Error in ==> imagesc at 19
hh = image(varargin{1},’CDataMapping’,’scaled’);
Error in ==> showkeys at 16
imagesc(image);
Error in ==> abcd at 3
showkeys(im1,loc1);
I AM GETTING THESE ERRORS WHILE RUNNING THE FOLLOWING MATLAB CODE
function num=match(im1,im2)
[im1,des1,loc1]=sift(‘mm.pgm’);
showkeys(im1,loc1);
[im2,des2,loc2]=sift(‘nn.pgm’);
showkeys(im2,loc2);
distRatio=0.6;
des2t =des2′;
for i = 1 : size(des1,1)
dotprods = des1(i,:) * des2t;
[vals,indx] = sort(acos(dotprods));
if (vals(1) < distRatio * vals(2))
match(i) = indx(1);
else
match(i) = 0;
end
end
im3 = appendimages(im1,im2);
figure(‘Position’, [100 100 size(im3,2) size(im3,1)]);
colormap(‘gray’);
imagesc(im3);
hold on;
cols1 = size(im1,2);
for i = 1: size(des1,1)
if (match(i) > 0)
line([loc1(i,2) loc2(match(i),2)+cols1], …
[loc1(i,1) loc2(match(i),1)], ‘Color’, ‘c’);
end
end
hold off
num = sum(match >0);
fprintf(‘Found %d matches.n’, num);
HELP ME PLEASE Finding keypoints…
3809 keypoints found.
Warning: Function D:siftDemoV4image.m has the same name as a MATLAB builtin. We
suggest you rename the function to avoid a potential name conflict.
> In sift at 48
In abcd at 2
Drawing SIFT keypoints …
??? Error using ==> image
Too many input arguments.
Error in ==> imagesc at 19
hh = image(varargin{1},’CDataMapping’,’scaled’);
Error in ==> showkeys at 16
imagesc(image);
Error in ==> abcd at 3
showkeys(im1,loc1);
I AM GETTING THESE ERRORS WHILE RUNNING THE FOLLOWING MATLAB CODE
function num=match(im1,im2)
[im1,des1,loc1]=sift(‘mm.pgm’);
showkeys(im1,loc1);
[im2,des2,loc2]=sift(‘nn.pgm’);
showkeys(im2,loc2);
distRatio=0.6;
des2t =des2′;
for i = 1 : size(des1,1)
dotprods = des1(i,:) * des2t;
[vals,indx] = sort(acos(dotprods));
if (vals(1) < distRatio * vals(2))
match(i) = indx(1);
else
match(i) = 0;
end
end
im3 = appendimages(im1,im2);
figure(‘Position’, [100 100 size(im3,2) size(im3,1)]);
colormap(‘gray’);
imagesc(im3);
hold on;
cols1 = size(im1,2);
for i = 1: size(des1,1)
if (match(i) > 0)
line([loc1(i,2) loc2(match(i),2)+cols1], …
[loc1(i,1) loc2(match(i),1)], ‘Color’, ‘c’);
end
end
hold off
num = sum(match >0);
fprintf(‘Found %d matches.n’, num);
HELP ME PLEASE redefining a built-in function MATLAB Answers — New Questions
How to draw an uncertain number of sub-images in one coordinate in app designer?
I can use matlab script to draw VMD decomposition diagram, but I don’t know how to draw such a diagram in one coordinate in app designer? Below is the code in my matlab script and the picture I need to draw. Thank you very much for your time.
[m,n]=size(u);
figure
subplot(m+1,1,1);
plot(DATA.data,’k’);grid on;
title(‘Original data’);
for i = 1:m
subplot(m+1,1,i+1);
plot(u(i,:),’k’);
title([‘Signal’,num2str(i-1),’:’]);
endI can use matlab script to draw VMD decomposition diagram, but I don’t know how to draw such a diagram in one coordinate in app designer? Below is the code in my matlab script and the picture I need to draw. Thank you very much for your time.
[m,n]=size(u);
figure
subplot(m+1,1,1);
plot(DATA.data,’k’);grid on;
title(‘Original data’);
for i = 1:m
subplot(m+1,1,i+1);
plot(u(i,:),’k’);
title([‘Signal’,num2str(i-1),’:’]);
end I can use matlab script to draw VMD decomposition diagram, but I don’t know how to draw such a diagram in one coordinate in app designer? Below is the code in my matlab script and the picture I need to draw. Thank you very much for your time.
[m,n]=size(u);
figure
subplot(m+1,1,1);
plot(DATA.data,’k’);grid on;
title(‘Original data’);
for i = 1:m
subplot(m+1,1,i+1);
plot(u(i,:),’k’);
title([‘Signal’,num2str(i-1),’:’]);
end appdesigner MATLAB Answers — New Questions
Want to get the maxima and minima not thr first maxima and minima. if i remove the 1 in this max_indices(1) they give error.
Want to get the maxima and minima not thr first maxima and minima. if i remove the 1 in this max_indices(1) they give error.
run("TestCode.m")Want to get the maxima and minima not thr first maxima and minima. if i remove the 1 in this max_indices(1) they give error.
run("TestCode.m") Want to get the maxima and minima not thr first maxima and minima. if i remove the 1 in this max_indices(1) they give error.
run("TestCode.m") islocalmaxima and minma MATLAB Answers — New Questions
how to use NARX tool for a vectors of input to output?
I have a input of matrix sample N = 100 with time span of 30 seconds with discretization with dt = 0.01. Input of and for and the corresponding output for . How can I use the "NARX Neural Networks" for the above data. Please refer above DATA.mat file . How could the vector 100 samples are used for training and validate the trained model?I have a input of matrix sample N = 100 with time span of 30 seconds with discretization with dt = 0.01. Input of and for and the corresponding output for . How can I use the "NARX Neural Networks" for the above data. Please refer above DATA.mat file . How could the vector 100 samples are used for training and validate the trained model? I have a input of matrix sample N = 100 with time span of 30 seconds with discretization with dt = 0.01. Input of and for and the corresponding output for . How can I use the "NARX Neural Networks" for the above data. Please refer above DATA.mat file . How could the vector 100 samples are used for training and validate the trained model? narxnet, deep learning with time series MATLAB Answers — New Questions
Table comparing Session Based Interface and Legacy Interface on daq toolbox
Is there a complete list of daq commands that shows the Session-based command for corresponding Legacy Interface ? For example, ‘daqhwinfo’ there is a small grey box note that says:
_"Note: You cannot use the legacy interface on 64–bit MATLAB. See Using the Session-Based Interface to acquire and generate data."_
It would be nice if this links to corresponding Session-based command instead of leaving us trying to figure it out. Very annoying.
Does such a list exist where I can search for legacy command and find corresponding session-based command ?Is there a complete list of daq commands that shows the Session-based command for corresponding Legacy Interface ? For example, ‘daqhwinfo’ there is a small grey box note that says:
_"Note: You cannot use the legacy interface on 64–bit MATLAB. See Using the Session-Based Interface to acquire and generate data."_
It would be nice if this links to corresponding Session-based command instead of leaving us trying to figure it out. Very annoying.
Does such a list exist where I can search for legacy command and find corresponding session-based command ? Is there a complete list of daq commands that shows the Session-based command for corresponding Legacy Interface ? For example, ‘daqhwinfo’ there is a small grey box note that says:
_"Note: You cannot use the legacy interface on 64–bit MATLAB. See Using the Session-Based Interface to acquire and generate data."_
It would be nice if this links to corresponding Session-based command instead of leaving us trying to figure it out. Very annoying.
Does such a list exist where I can search for legacy command and find corresponding session-based command ? ni-daq, session based interface, legacy interface, daq toolbox MATLAB Answers — New Questions
Model of two differential equations of RLC circuit (Simulink)
Hello,
I have made an RLC circuit and I want to simulate this system. I know, that I can model the exact same circuit, but I want to get graphs from my two differential equations. I am kinda struggling with the model of those equations. I have already read a lot of articles, but i still can not figure out, how to apply the knowledge from those articles and from my self-studying.
I have those differential equations:
where U is voltage (I will probably use sinwave block); i1, i2, i3 are 3 currents.
Could somebody, please, give me a hint or any simillar example of Simulink model?Hello,
I have made an RLC circuit and I want to simulate this system. I know, that I can model the exact same circuit, but I want to get graphs from my two differential equations. I am kinda struggling with the model of those equations. I have already read a lot of articles, but i still can not figure out, how to apply the knowledge from those articles and from my self-studying.
I have those differential equations:
where U is voltage (I will probably use sinwave block); i1, i2, i3 are 3 currents.
Could somebody, please, give me a hint or any simillar example of Simulink model? Hello,
I have made an RLC circuit and I want to simulate this system. I know, that I can model the exact same circuit, but I want to get graphs from my two differential equations. I am kinda struggling with the model of those equations. I have already read a lot of articles, but i still can not figure out, how to apply the knowledge from those articles and from my self-studying.
I have those differential equations:
where U is voltage (I will probably use sinwave block); i1, i2, i3 are 3 currents.
Could somebody, please, give me a hint or any simillar example of Simulink model? simulink, rlc, two differential equations, matlab, graphs, voltage, current MATLAB Answers — New Questions
Unable to resolve the name audio.internal.visualizer.Filter.
Hello!
I keep getting the following error when executing the script AudioSystemToolboxIntroMain.m that accopanies the webinar "Real-time Audio Processing for Algorithm Prototyping and Custom Measurements" (https://se.mathworks.com/videos/real-time-audio-processing-for-algorithm-prototyping-and-custom-measurements-121075.html):
(Executing RealTimeStreaming.m works.)
Unable to resolve the name audio.internal.visualizer.Filter.
Error in ThreeBandParamEQ/visualize (line 122)
obj.visualObj = audio.internal.visualizer.Filter(coeffs,…
Error in AudioSystemToolboxIntroMain (line 10)
visualize(eq)
I believe that I have all required toolboxes installed:
>> ver
—————————————————————————————————–
MATLAB Version: 9.9.0.1467703 (R2020b)
MATLAB License Number: XXX
Operating System: Mac OS X Version: 10.15.7 Build: 19H2
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 9.9 (R2020b)
Simulink Version 10.2 (R2020b)
Antenna Toolbox Version 4.3 (R2020b)
Audio Toolbox Version 2.3 (R2020b)
Computer Vision Toolbox Version 9.3 (R2020b)
Curve Fitting Toolbox Version 3.5.12 (R2020b)
DSP System Toolbox Version 9.11 (R2020b)
Image Acquisition Toolbox Version 6.3 (R2020b)
Image Processing Toolbox Version 11.2 (R2020b)
MATLAB Compiler Version 8.1 (R2020b)
MATLAB Compiler SDK Version 6.9 (R2020b)
Optimization Toolbox Version 9.0 (R2020b)
Phased Array System Toolbox Version 4.4 (R2020b)
Signal Processing Toolbox Version 8.5 (R2020b)
Statistics and Machine Learning Toolbox Version 12.0 (R2020b)
Symbolic Math Toolbox Version 8.6 (R2020b)
I’ve tried
rehash toolboxcache
and reverting pathdef.m without success.
Thanks!Hello!
I keep getting the following error when executing the script AudioSystemToolboxIntroMain.m that accopanies the webinar "Real-time Audio Processing for Algorithm Prototyping and Custom Measurements" (https://se.mathworks.com/videos/real-time-audio-processing-for-algorithm-prototyping-and-custom-measurements-121075.html):
(Executing RealTimeStreaming.m works.)
Unable to resolve the name audio.internal.visualizer.Filter.
Error in ThreeBandParamEQ/visualize (line 122)
obj.visualObj = audio.internal.visualizer.Filter(coeffs,…
Error in AudioSystemToolboxIntroMain (line 10)
visualize(eq)
I believe that I have all required toolboxes installed:
>> ver
—————————————————————————————————–
MATLAB Version: 9.9.0.1467703 (R2020b)
MATLAB License Number: XXX
Operating System: Mac OS X Version: 10.15.7 Build: 19H2
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 9.9 (R2020b)
Simulink Version 10.2 (R2020b)
Antenna Toolbox Version 4.3 (R2020b)
Audio Toolbox Version 2.3 (R2020b)
Computer Vision Toolbox Version 9.3 (R2020b)
Curve Fitting Toolbox Version 3.5.12 (R2020b)
DSP System Toolbox Version 9.11 (R2020b)
Image Acquisition Toolbox Version 6.3 (R2020b)
Image Processing Toolbox Version 11.2 (R2020b)
MATLAB Compiler Version 8.1 (R2020b)
MATLAB Compiler SDK Version 6.9 (R2020b)
Optimization Toolbox Version 9.0 (R2020b)
Phased Array System Toolbox Version 4.4 (R2020b)
Signal Processing Toolbox Version 8.5 (R2020b)
Statistics and Machine Learning Toolbox Version 12.0 (R2020b)
Symbolic Math Toolbox Version 8.6 (R2020b)
I’ve tried
rehash toolboxcache
and reverting pathdef.m without success.
Thanks! Hello!
I keep getting the following error when executing the script AudioSystemToolboxIntroMain.m that accopanies the webinar "Real-time Audio Processing for Algorithm Prototyping and Custom Measurements" (https://se.mathworks.com/videos/real-time-audio-processing-for-algorithm-prototyping-and-custom-measurements-121075.html):
(Executing RealTimeStreaming.m works.)
Unable to resolve the name audio.internal.visualizer.Filter.
Error in ThreeBandParamEQ/visualize (line 122)
obj.visualObj = audio.internal.visualizer.Filter(coeffs,…
Error in AudioSystemToolboxIntroMain (line 10)
visualize(eq)
I believe that I have all required toolboxes installed:
>> ver
—————————————————————————————————–
MATLAB Version: 9.9.0.1467703 (R2020b)
MATLAB License Number: XXX
Operating System: Mac OS X Version: 10.15.7 Build: 19H2
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 9.9 (R2020b)
Simulink Version 10.2 (R2020b)
Antenna Toolbox Version 4.3 (R2020b)
Audio Toolbox Version 2.3 (R2020b)
Computer Vision Toolbox Version 9.3 (R2020b)
Curve Fitting Toolbox Version 3.5.12 (R2020b)
DSP System Toolbox Version 9.11 (R2020b)
Image Acquisition Toolbox Version 6.3 (R2020b)
Image Processing Toolbox Version 11.2 (R2020b)
MATLAB Compiler Version 8.1 (R2020b)
MATLAB Compiler SDK Version 6.9 (R2020b)
Optimization Toolbox Version 9.0 (R2020b)
Phased Array System Toolbox Version 4.4 (R2020b)
Signal Processing Toolbox Version 8.5 (R2020b)
Statistics and Machine Learning Toolbox Version 12.0 (R2020b)
Symbolic Math Toolbox Version 8.6 (R2020b)
I’ve tried
rehash toolboxcache
and reverting pathdef.m without success.
Thanks! audio MATLAB Answers — New Questions
how to get the pixel value of histogram?
Hello
i wants to delete or make some pixel zero , according to the bins.
im = imread (‘image’);
hsv_im = rgb2hsv(im);
h = hsv_im(:,:,1)
[pixelCount, grayLevels] = hist(h(:), 360);
pixelCount(20:30)=0;
Now i want to get my ‘Hue’ Matrix with same pixel position and zeros between the bin values from 20 to 30.Hello
i wants to delete or make some pixel zero , according to the bins.
im = imread (‘image’);
hsv_im = rgb2hsv(im);
h = hsv_im(:,:,1)
[pixelCount, grayLevels] = hist(h(:), 360);
pixelCount(20:30)=0;
Now i want to get my ‘Hue’ Matrix with same pixel position and zeros between the bin values from 20 to 30. Hello
i wants to delete or make some pixel zero , according to the bins.
im = imread (‘image’);
hsv_im = rgb2hsv(im);
h = hsv_im(:,:,1)
[pixelCount, grayLevels] = hist(h(:), 360);
pixelCount(20:30)=0;
Now i want to get my ‘Hue’ Matrix with same pixel position and zeros between the bin values from 20 to 30. image processing, digital image processing, image analysis, image segmentation MATLAB Answers — New Questions
Pre-emphasis filter
Hello everybody
My question is:-
firstly,I should record any speech signal with 8KHZ and 8 bit and I don’t know how can I apply speech signal with (8KHZ and 8 bit)
and then I must pass this speech signal throw pre-emphasis filter and finaly I listen to the differencr after and before filtering.
But another confusing thing for me that my pro said I must use cinvolution in my program
And I did my program but I’m not sure from it because I have error like this
??? Error using ==> conv at 27
A and B must be vectors.
Error in ==> speech2 at 18
s3=conv(s1,ypre);
and I don’t know how can I add 8kHZ and 8 bit in true form in my program
The program:-
f=8000;
apre=[1];
[s1,f]=wavread(‘C:UsersNDesktopfamily.wav’);
figure(1)
plot(s1)
title(‘speech signal’);
sound(s1,f);
pause
% design pre-emphasis filter
bpre=[1 -0.95];
fvtool(bpre,apre);
ypre=filter(bpre,apre,s1);
figure(2)
plot(ypre);
title(‘First filter response’);
sound(ypre,f);
pause
s3=conv(s1,ypre);
figure(3);
plot(s3);
title(‘speech after filtering’);
sound(m,fs);
pauseHello everybody
My question is:-
firstly,I should record any speech signal with 8KHZ and 8 bit and I don’t know how can I apply speech signal with (8KHZ and 8 bit)
and then I must pass this speech signal throw pre-emphasis filter and finaly I listen to the differencr after and before filtering.
But another confusing thing for me that my pro said I must use cinvolution in my program
And I did my program but I’m not sure from it because I have error like this
??? Error using ==> conv at 27
A and B must be vectors.
Error in ==> speech2 at 18
s3=conv(s1,ypre);
and I don’t know how can I add 8kHZ and 8 bit in true form in my program
The program:-
f=8000;
apre=[1];
[s1,f]=wavread(‘C:UsersNDesktopfamily.wav’);
figure(1)
plot(s1)
title(‘speech signal’);
sound(s1,f);
pause
% design pre-emphasis filter
bpre=[1 -0.95];
fvtool(bpre,apre);
ypre=filter(bpre,apre,s1);
figure(2)
plot(ypre);
title(‘First filter response’);
sound(ypre,f);
pause
s3=conv(s1,ypre);
figure(3);
plot(s3);
title(‘speech after filtering’);
sound(m,fs);
pause Hello everybody
My question is:-
firstly,I should record any speech signal with 8KHZ and 8 bit and I don’t know how can I apply speech signal with (8KHZ and 8 bit)
and then I must pass this speech signal throw pre-emphasis filter and finaly I listen to the differencr after and before filtering.
But another confusing thing for me that my pro said I must use cinvolution in my program
And I did my program but I’m not sure from it because I have error like this
??? Error using ==> conv at 27
A and B must be vectors.
Error in ==> speech2 at 18
s3=conv(s1,ypre);
and I don’t know how can I add 8kHZ and 8 bit in true form in my program
The program:-
f=8000;
apre=[1];
[s1,f]=wavread(‘C:UsersNDesktopfamily.wav’);
figure(1)
plot(s1)
title(‘speech signal’);
sound(s1,f);
pause
% design pre-emphasis filter
bpre=[1 -0.95];
fvtool(bpre,apre);
ypre=filter(bpre,apre,s1);
figure(2)
plot(ypre);
title(‘First filter response’);
sound(ypre,f);
pause
s3=conv(s1,ypre);
figure(3);
plot(s3);
title(‘speech after filtering’);
sound(m,fs);
pause signal processing MATLAB Answers — New Questions
Cannot simulate flow rate changes in response to pressure differences in the air chamber
Cannot simulate flow rate changes in response to pressure differences in the air chamber
Two chambers with different initial pressures are connected by a Local Restriction (MA), which is commanded to close until a certain point in time and open after that time.
In this case, we expected that the chambers with different pressures would be connected at the timing when Local Restriction was opened, and air would move from the chamber with the higher pressure to the chamber with the lower pressure.
However, the result was that terminal A of Local Restriction was below the minimum effective pressure and an error occurred.
The settings are: chamber 1 initial pressure is 10.13 kPa; chamber 2 initial pressure is 101.3 kPa; Local Restriction is fully opened after 360 second.
Please tell me how to create a model in which air moves according to the pressure difference between chambers.
The attached image shows the model and output.Cannot simulate flow rate changes in response to pressure differences in the air chamber
Two chambers with different initial pressures are connected by a Local Restriction (MA), which is commanded to close until a certain point in time and open after that time.
In this case, we expected that the chambers with different pressures would be connected at the timing when Local Restriction was opened, and air would move from the chamber with the higher pressure to the chamber with the lower pressure.
However, the result was that terminal A of Local Restriction was below the minimum effective pressure and an error occurred.
The settings are: chamber 1 initial pressure is 10.13 kPa; chamber 2 initial pressure is 101.3 kPa; Local Restriction is fully opened after 360 second.
Please tell me how to create a model in which air moves according to the pressure difference between chambers.
The attached image shows the model and output. Cannot simulate flow rate changes in response to pressure differences in the air chamber
Two chambers with different initial pressures are connected by a Local Restriction (MA), which is commanded to close until a certain point in time and open after that time.
In this case, we expected that the chambers with different pressures would be connected at the timing when Local Restriction was opened, and air would move from the chamber with the higher pressure to the chamber with the lower pressure.
However, the result was that terminal A of Local Restriction was below the minimum effective pressure and an error occurred.
The settings are: chamber 1 initial pressure is 10.13 kPa; chamber 2 initial pressure is 101.3 kPa; Local Restriction is fully opened after 360 second.
Please tell me how to create a model in which air moves according to the pressure difference between chambers.
The attached image shows the model and output. simulink, simscape, simscape fluide MATLAB Answers — New Questions
Serial reading and splitting data needs to be faster
The serial has to be read and the data has to be converged to a easy readable double matrix like …x1 double. I need to read the buffer and creates this matrix quickly so other code can run after. Reading the buffer is quick (0.5s), but I would like a speed improvement for creating the matrix (11s). Any ideas?
% stm = serial("COM5", ‘Baudrate’, 2000000);
% stm.InputBufferSize = 100000000; %100MB buffer, max is 2GB
% fopen(stm);
amount = 200;
data = cell(amount,1);
NotFullData = fscanf(stm); %make sure adc is on before sending and discard this
tic;
for i=1:1:amount
data{i} = fscanf(stm);
end
toc;
% fclose(stm);
%This part is slower
num_chunks = 8192;
len = length(data);
tic;
chunks = zeros(len*num_chunks, 1);
for a = 1:length(data)
data_buffer = cell2mat(data(a));
for i = 1:num_chunks
start_index = (i – 1) * 4 + 1;
end_index = start_index + 3;
chunks((a-1)*num_chunks+i,1) = str2double(data_buffer(start_index:end_index));
end
end
toc;
fscanf(stm); gives 1×32769 char
e.g. 3036303630343035303630363036303230333035303530353034303430363035303330333033303530353034303530353034303530313032303830353035303530343036303230343034303430363036303530343032303330343033303430353034303530353035303230333033303730343034303230323034303330283032
This code is even slower
% stm = serial("COM5", ‘Baudrate’, 2000000);
% stm.InputBufferSize = 200000000; %200MB buffer, max is 2GB
% fopen(stm);
amount = 200;
data = zeros(amount*8192,1);
NotFullData = fscanf(stm); %make sure adc is on before sending and discard this
tic;
for i=1:1:amount
read_data = fscanf(stm);
data_temp = str2double(cellstr(reshape(read_data(1:end-1),4,[])’));
for a=1:1:8192
data((i-1)*8192+a) = data_temp(a);
end
end
toc;
% fclose(stm);The serial has to be read and the data has to be converged to a easy readable double matrix like …x1 double. I need to read the buffer and creates this matrix quickly so other code can run after. Reading the buffer is quick (0.5s), but I would like a speed improvement for creating the matrix (11s). Any ideas?
% stm = serial("COM5", ‘Baudrate’, 2000000);
% stm.InputBufferSize = 100000000; %100MB buffer, max is 2GB
% fopen(stm);
amount = 200;
data = cell(amount,1);
NotFullData = fscanf(stm); %make sure adc is on before sending and discard this
tic;
for i=1:1:amount
data{i} = fscanf(stm);
end
toc;
% fclose(stm);
%This part is slower
num_chunks = 8192;
len = length(data);
tic;
chunks = zeros(len*num_chunks, 1);
for a = 1:length(data)
data_buffer = cell2mat(data(a));
for i = 1:num_chunks
start_index = (i – 1) * 4 + 1;
end_index = start_index + 3;
chunks((a-1)*num_chunks+i,1) = str2double(data_buffer(start_index:end_index));
end
end
toc;
fscanf(stm); gives 1×32769 char
e.g. 3036303630343035303630363036303230333035303530353034303430363035303330333033303530353034303530353034303530313032303830353035303530343036303230343034303430363036303530343032303330343033303430353034303530353035303230333033303730343034303230323034303330283032
This code is even slower
% stm = serial("COM5", ‘Baudrate’, 2000000);
% stm.InputBufferSize = 200000000; %200MB buffer, max is 2GB
% fopen(stm);
amount = 200;
data = zeros(amount*8192,1);
NotFullData = fscanf(stm); %make sure adc is on before sending and discard this
tic;
for i=1:1:amount
read_data = fscanf(stm);
data_temp = str2double(cellstr(reshape(read_data(1:end-1),4,[])’));
for a=1:1:8192
data((i-1)*8192+a) = data_temp(a);
end
end
toc;
% fclose(stm); The serial has to be read and the data has to be converged to a easy readable double matrix like …x1 double. I need to read the buffer and creates this matrix quickly so other code can run after. Reading the buffer is quick (0.5s), but I would like a speed improvement for creating the matrix (11s). Any ideas?
% stm = serial("COM5", ‘Baudrate’, 2000000);
% stm.InputBufferSize = 100000000; %100MB buffer, max is 2GB
% fopen(stm);
amount = 200;
data = cell(amount,1);
NotFullData = fscanf(stm); %make sure adc is on before sending and discard this
tic;
for i=1:1:amount
data{i} = fscanf(stm);
end
toc;
% fclose(stm);
%This part is slower
num_chunks = 8192;
len = length(data);
tic;
chunks = zeros(len*num_chunks, 1);
for a = 1:length(data)
data_buffer = cell2mat(data(a));
for i = 1:num_chunks
start_index = (i – 1) * 4 + 1;
end_index = start_index + 3;
chunks((a-1)*num_chunks+i,1) = str2double(data_buffer(start_index:end_index));
end
end
toc;
fscanf(stm); gives 1×32769 char
e.g. 3036303630343035303630363036303230333035303530353034303430363035303330333033303530353034303530353034303530313032303830353035303530343036303230343034303430363036303530343032303330343033303430353034303530353035303230333033303730343034303230323034303330283032
This code is even slower
% stm = serial("COM5", ‘Baudrate’, 2000000);
% stm.InputBufferSize = 200000000; %200MB buffer, max is 2GB
% fopen(stm);
amount = 200;
data = zeros(amount*8192,1);
NotFullData = fscanf(stm); %make sure adc is on before sending and discard this
tic;
for i=1:1:amount
read_data = fscanf(stm);
data_temp = str2double(cellstr(reshape(read_data(1:end-1),4,[])’));
for a=1:1:8192
data((i-1)*8192+a) = data_temp(a);
end
end
toc;
% fclose(stm); serial MATLAB Answers — New Questions
how to access Simulink Compiler (or any other way for real-time app designer and simulink interface)?
Target: Real-time interface between app designer and simulink (found some appropriate solution if use Simulink Compiler but unable to access or use this Compiler)Target: Real-time interface between app designer and simulink (found some appropriate solution if use Simulink Compiler but unable to access or use this Compiler) Target: Real-time interface between app designer and simulink (found some appropriate solution if use Simulink Compiler but unable to access or use this Compiler) interface real-time, simulink, appdesigner MATLAB Answers — New Questions
Problem with Simulink Onramp Task 7.2
Hi,
During the Simulink Onramp, I’ve stranded on Task 7.2 with the following issue. All code is correct and checked a few times now. Since I don’t know the function that errors or what input is of type char, I’m stuck. I’ve tested to replace the MATLAB function with the fcn-block and then everything works fine. As soon as I add a MATLAB function block, i get the error – no matter if it is the prepared block from the task or a nex from simulink. It does not matter what code I fill it with, so it feels like there is a missmatch in the communication from Simulink into the block type itself.Hi,
During the Simulink Onramp, I’ve stranded on Task 7.2 with the following issue. All code is correct and checked a few times now. Since I don’t know the function that errors or what input is of type char, I’m stuck. I’ve tested to replace the MATLAB function with the fcn-block and then everything works fine. As soon as I add a MATLAB function block, i get the error – no matter if it is the prepared block from the task or a nex from simulink. It does not matter what code I fill it with, so it feels like there is a missmatch in the communication from Simulink into the block type itself. Hi,
During the Simulink Onramp, I’ve stranded on Task 7.2 with the following issue. All code is correct and checked a few times now. Since I don’t know the function that errors or what input is of type char, I’m stuck. I’ve tested to replace the MATLAB function with the fcn-block and then everything works fine. As soon as I add a MATLAB function block, i get the error – no matter if it is the prepared block from the task or a nex from simulink. It does not matter what code I fill it with, so it feels like there is a missmatch in the communication from Simulink into the block type itself. simulink onramp, task 7.2, matlab function block MATLAB Answers — New Questions
Use a compiled Library .a extension in simulink
Hello,
I have a compiled library file .a extension, I need to import this file into simulink and use it in my simulation activities. How can I use this file in simulink? I need to integrate it as a block in a big model?
Thank you in advance for your response.
Regards,
Ali ISSAHello,
I have a compiled library file .a extension, I need to import this file into simulink and use it in my simulation activities. How can I use this file in simulink? I need to integrate it as a block in a big model?
Thank you in advance for your response.
Regards,
Ali ISSA Hello,
I have a compiled library file .a extension, I need to import this file into simulink and use it in my simulation activities. How can I use this file in simulink? I need to integrate it as a block in a big model?
Thank you in advance for your response.
Regards,
Ali ISSA import library, simulink MATLAB Answers — New Questions
Fitting a function with constraints
Hi
I am currently struggling to fit a 2nd order polynomial function with specific constraints.
I have an external script that tells me wether the polynomial function is ascending, descending or u-shaped.
Therefore I’ve made a constraints (using the "fit" command) for the x^2 part to only be positive because I can only use downwards curves.
This is my current formula:
[p,gof] = fit(x,y,’poly2′,’lower’,[0,-inf,-inf],’normalize’,’on’)
Now I need to give specific constraint for each shape:
ascending: The minimum y-value must be at the first x-value (ymin = xmin)
descending: The minimum y-value must be at the last x-value (ymin = xmax)
U-curve: The minimum y-value must be in between the first and last x-value (xmin < ymin < xmax)Hi
I am currently struggling to fit a 2nd order polynomial function with specific constraints.
I have an external script that tells me wether the polynomial function is ascending, descending or u-shaped.
Therefore I’ve made a constraints (using the "fit" command) for the x^2 part to only be positive because I can only use downwards curves.
This is my current formula:
[p,gof] = fit(x,y,’poly2′,’lower’,[0,-inf,-inf],’normalize’,’on’)
Now I need to give specific constraint for each shape:
ascending: The minimum y-value must be at the first x-value (ymin = xmin)
descending: The minimum y-value must be at the last x-value (ymin = xmax)
U-curve: The minimum y-value must be in between the first and last x-value (xmin < ymin < xmax) Hi
I am currently struggling to fit a 2nd order polynomial function with specific constraints.
I have an external script that tells me wether the polynomial function is ascending, descending or u-shaped.
Therefore I’ve made a constraints (using the "fit" command) for the x^2 part to only be positive because I can only use downwards curves.
This is my current formula:
[p,gof] = fit(x,y,’poly2′,’lower’,[0,-inf,-inf],’normalize’,’on’)
Now I need to give specific constraint for each shape:
ascending: The minimum y-value must be at the first x-value (ymin = xmin)
descending: The minimum y-value must be at the last x-value (ymin = xmax)
U-curve: The minimum y-value must be in between the first and last x-value (xmin < ymin < xmax) curve fitting MATLAB Answers — New Questions
Is it possible to merge two experience buffers generated during training of the same agent?
Hallo,
I have trained an agent on two PCs for a while and got two "agent" objects with respective experience buffers. As these two were generated during training of same agent interacting with same environment, I am wondering if it is possible to merge these two and continue training with merged experience buffer.
YoursHallo,
I have trained an agent on two PCs for a while and got two "agent" objects with respective experience buffers. As these two were generated during training of same agent interacting with same environment, I am wondering if it is possible to merge these two and continue training with merged experience buffer.
Yours Hallo,
I have trained an agent on two PCs for a while and got two "agent" objects with respective experience buffers. As these two were generated during training of same agent interacting with same environment, I am wondering if it is possible to merge these two and continue training with merged experience buffer.
Yours reinforcement learning, experience buffer MATLAB Answers — New Questions
Unable to download Support Package
Hello, Does anyone of you could share the offline files of the support packages for Texas Instruments C2000 and/or Arduino DUE under Matlab r2015b (win32). I ve tried all techniques to solve this issue but end up with no solutions. It seems that Mathworks’ servers reject every download from this release (cf. Picture)!
<</matlabcentral/answers/uploaded_files/1708621/w2.jpg>>Hello, Does anyone of you could share the offline files of the support packages for Texas Instruments C2000 and/or Arduino DUE under Matlab r2015b (win32). I ve tried all techniques to solve this issue but end up with no solutions. It seems that Mathworks’ servers reject every download from this release (cf. Picture)!
<</matlabcentral/answers/uploaded_files/1708621/w2.jpg>> Hello, Does anyone of you could share the offline files of the support packages for Texas Instruments C2000 and/or Arduino DUE under Matlab r2015b (win32). I ve tried all techniques to solve this issue but end up with no solutions. It seems that Mathworks’ servers reject every download from this release (cf. Picture)!
<</matlabcentral/answers/uploaded_files/1708621/w2.jpg>> support-package, tic2000, arduino MATLAB Answers — New Questions
Flexible Body Model Builder – What causes unexpected error?
Hello everyone,
I’m working with a relatively complex goemetry in the FlexibleBodyModelBuilder tool. It’s a thin-walled structure with the thinnest walls being 1mm thick. I set the min element size to 0,5mm. I’ve tried both ROM generators and run into unexpected errors
Any idea what could be wrong? Is my geometry just too complex? Any insights are much apprecieated!
Best regards,
AtliHello everyone,
I’m working with a relatively complex goemetry in the FlexibleBodyModelBuilder tool. It’s a thin-walled structure with the thinnest walls being 1mm thick. I set the min element size to 0,5mm. I’ve tried both ROM generators and run into unexpected errors
Any idea what could be wrong? Is my geometry just too complex? Any insights are much apprecieated!
Best regards,
Atli Hello everyone,
I’m working with a relatively complex goemetry in the FlexibleBodyModelBuilder tool. It’s a thin-walled structure with the thinnest walls being 1mm thick. I set the min element size to 0,5mm. I’ve tried both ROM generators and run into unexpected errors
Any idea what could be wrong? Is my geometry just too complex? Any insights are much apprecieated!
Best regards,
Atli flexiblebodymodelbuilder, unexpected error, rom generator, complex geometry MATLAB Answers — New Questions
xline issue with adding a number to the line through the labels option
Is there a reason why the xline (or yline) functions won’t accept a number converted to a string
c=b(3); %Breakpoint
cs=num2str(c)
class(cs)
xline(ax3,c,cs);
cs =
‘125.7048’
ans =
‘char’
Error using xline
Invalid parameter/value pair arguments.Is there a reason why the xline (or yline) functions won’t accept a number converted to a string
c=b(3); %Breakpoint
cs=num2str(c)
class(cs)
xline(ax3,c,cs);
cs =
‘125.7048’
ans =
‘char’
Error using xline
Invalid parameter/value pair arguments. Is there a reason why the xline (or yline) functions won’t accept a number converted to a string
c=b(3); %Breakpoint
cs=num2str(c)
class(cs)
xline(ax3,c,cs);
cs =
‘125.7048’
ans =
‘char’
Error using xline
Invalid parameter/value pair arguments. xline, yline MATLAB Answers — New Questions