Month: June 2024
VBA Form Command Button not working
I’m going out of my mind trying to resolve this issue. I have succeeded at creating and using macros without issue, yet all my efforts at testing a simple VBA form command button based on youtube instructions fall flat. I have spent several days researching every possible cause and solution without success. I have even gone as far as removing and reinstalling Microsoft 365, as well as factory resetting Excel by deleting Excel’s folder using RegEdit. My non-form macros work without issue. Yet creating a single form command button to general a VBA MsgBox fails to work. Please keep in mind that I usually have no difficulties resolving any problems that come my way. This time however, NOTHING!. NADA!
I’m going out of my mind trying to resolve this issue. I have succeeded at creating and using macros without issue, yet all my efforts at testing a simple VBA form command button based on youtube instructions fall flat. I have spent several days researching every possible cause and solution without success. I have even gone as far as removing and reinstalling Microsoft 365, as well as factory resetting Excel by deleting Excel’s folder using RegEdit. My non-form macros work without issue. Yet creating a single form command button to general a VBA MsgBox fails to work. Please keep in mind that I usually have no difficulties resolving any problems that come my way. This time however, NOTHING!. NADA! Read More
How can I change the cell colour of one cell based on either another cells’ colour OR value?
Hey guys!
Working on a personal study tracker, and would really appreciate any guidance/support on this step I’m trying to setup.
Note:
– Cells from Column D12 onwards below = date
– Cells from Column E12 onwards below = my score
I would like the cells in the D and E column, e.g. D12 AND E12 to change to the same colour based on the score in column E, which are as follows:: Cell scores: 0-2.5 = Red Cells; 2.5-4 = Orange Cells, 4-5 = Green Creeks
These cells in D & E should simultaneously change to the same colour, of which there are only 3 I need: Red, Orange, Green (as you can see in: E1:G2) – if it helps, each cells’ colour-index code is listed in cells: E5:G5 (in corresponding vertical order).
From looking into this, there’s a few ways to do this. I can either have column D change colour by either column E’s score OR cell colour. I believe the latter would work best and should be more straight-forward(?).
I’m confident in setting up the conditional formatting for column E by doing: Home>Conditional Formatting>Highlight Cell Rules>*Clicking the appropriate rule*>Input values and select background colour — but, this only deals with Column E; Column D wouldn’t immediately synchronise with this.
I’ve briefly researched into VBA (a whole new world!) & Conditional Fomatting>New Rule>”Use a formula… to format” — I’ve been able to wrap my head around the latter, but I’m not getting the result as I know I’m messing up with the formula.
ALSO, in case it’s worth noting. I have my Excel spreadsheet saved in ‘XLSM’ format instead of ‘XLSX’ as I was watching a VBA video for this and was informed to save the spreadsheet in this format. Not sure if this may impact any advice, hence the mention just in case.
I hope this makes sense! Happy to elaborate further if need ne.
Again, I really appreciate anyone whom takes it out of their time to help out. Many thanks in advance!
Hey guys! Working on a personal study tracker, and would really appreciate any guidance/support on this step I’m trying to setup.Note:- Cells from Column D12 onwards below = date- Cells from Column E12 onwards below = my score I would like the cells in the D and E column, e.g. D12 AND E12 to change to the same colour based on the score in column E, which are as follows:: Cell scores: 0-2.5 = Red Cells; 2.5-4 = Orange Cells, 4-5 = Green Creeks These cells in D & E should simultaneously change to the same colour, of which there are only 3 I need: Red, Orange, Green (as you can see in: E1:G2) – if it helps, each cells’ colour-index code is listed in cells: E5:G5 (in corresponding vertical order). From looking into this, there’s a few ways to do this. I can either have column D change colour by either column E’s score OR cell colour. I believe the latter would work best and should be more straight-forward(?).I’m confident in setting up the conditional formatting for column E by doing: Home>Conditional Formatting>Highlight Cell Rules>*Clicking the appropriate rule*>Input values and select background colour — but, this only deals with Column E; Column D wouldn’t immediately synchronise with this. I’ve briefly researched into VBA (a whole new world!) & Conditional Fomatting>New Rule>”Use a formula… to format” — I’ve been able to wrap my head around the latter, but I’m not getting the result as I know I’m messing up with the formula. ALSO, in case it’s worth noting. I have my Excel spreadsheet saved in ‘XLSM’ format instead of ‘XLSX’ as I was watching a VBA video for this and was informed to save the spreadsheet in this format. Not sure if this may impact any advice, hence the mention just in case. I hope this makes sense! Happy to elaborate further if need ne. Again, I really appreciate anyone whom takes it out of their time to help out. Many thanks in advance! Read More
Supporting Women in the Data Center Development Realm – Women in Construction
With the amount of the Data Centers being constructed globally to support the Microsoft Capacity Business goals, as a former Microsoft DCD (Data Center Development) team member myself, I saw first hand how more women in the industry of construction require advocacy and sponsorship in their careers.
My non-profit 501c3 has been focused on just that. Build-her.Org is focused on finalizing our book Build-her, Be Heard this fall 2024 that acts as a personal growth guide for women, helping them find support and success in their careers in construction or related fields. I urge you to take a look and follow for continued updates or support our cause.
With the amount of the Data Centers being constructed globally to support the Microsoft Capacity Business goals, as a former Microsoft DCD (Data Center Development) team member myself, I saw first hand how more women in the industry of construction require advocacy and sponsorship in their careers. My non-profit 501c3 has been focused on just that. Build-her.Org is focused on finalizing our book Build-her, Be Heard this fall 2024 that acts as a personal growth guide for women, helping them find support and success in their careers in construction or related fields. I urge you to take a look and follow for continued updates or support our cause. Read More
MATLAB update working with a dSPACE license
Hello,
I have a dSPACE platform (MicrolabBox) with RTI1202 activated with MATLAB R2016 and I need some blocks that are developed in MATLAB 2022a.
My question is: Will the MicrolabBox still work if I made the update from MATLAB R2016a to MATLAB R2022a?
Thank you very much!Hello,
I have a dSPACE platform (MicrolabBox) with RTI1202 activated with MATLAB R2016 and I need some blocks that are developed in MATLAB 2022a.
My question is: Will the MicrolabBox still work if I made the update from MATLAB R2016a to MATLAB R2022a?
Thank you very much! Hello,
I have a dSPACE platform (MicrolabBox) with RTI1202 activated with MATLAB R2016 and I need some blocks that are developed in MATLAB 2022a.
My question is: Will the MicrolabBox still work if I made the update from MATLAB R2016a to MATLAB R2022a?
Thank you very much! matlab version, dspace MATLAB Answers — New Questions
VBA module in Word Normal Template not saved
Hi,
Windows 10 64 bits, Office Professional 2016, Word
I code in VBA7, my module is in the Normal template. Since a few days, my module is not saved correctly in Normal template when I press Ctrl-S or use the menu. It looks like it is saved in a WRLxxxx file (that’s what I I see in the the VBA Editor window title), with xxxx looking random. I cannot find my code back in the Normal template at next Word session.
I tried this:
– repare Office function (didn’t work)
– quit Word, rename Normal.docm, restart Word (creates a new Normal.docm), import module in the freshly created Normal template (did’nt work)
– checked add-ons : no add-ons (except inactive OneNore add-on
Can someone help ? Thank you.
Kind regards,
Jean-Pierre
Hi,Windows 10 64 bits, Office Professional 2016, WordI code in VBA7, my module is in the Normal template. Since a few days, my module is not saved correctly in Normal template when I press Ctrl-S or use the menu. It looks like it is saved in a WRLxxxx file (that’s what I I see in the the VBA Editor window title), with xxxx looking random. I cannot find my code back in the Normal template at next Word session.I tried this:- repare Office function (didn’t work)- quit Word, rename Normal.docm, restart Word (creates a new Normal.docm), import module in the freshly created Normal template (did’nt work)- checked add-ons : no add-ons (except inactive OneNore add-on Can someone help ? Thank you.Kind regards,Jean-Pierre Read More
Start Geoscience with MATLAB
Good Evening, Im a physcis student, but now i want to study on geoscience and particularly using MATLAB to help me to integrating all my physics background into analyzing, visualizing, etc. with geoscience case. Is there any advice where to start into this field? thx in advanceGood Evening, Im a physcis student, but now i want to study on geoscience and particularly using MATLAB to help me to integrating all my physics background into analyzing, visualizing, etc. with geoscience case. Is there any advice where to start into this field? thx in advance Good Evening, Im a physcis student, but now i want to study on geoscience and particularly using MATLAB to help me to integrating all my physics background into analyzing, visualizing, etc. with geoscience case. Is there any advice where to start into this field? thx in advance geoscience, physics, mapping toolbox, matlab MATLAB Answers — New Questions
HYDROGEN FUEL CELL TECHNOLOGY FOR EFFICIENT LITHIUM BATTERY CHARGING
how to connect the hydrogen fuel cell with cccv battery charger to charge the battery?how to connect the hydrogen fuel cell with cccv battery charger to charge the battery? how to connect the hydrogen fuel cell with cccv battery charger to charge the battery? hydrogen full cell stack, cccv MATLAB Answers — New Questions
orthogonal projection of 3D nodes onto a 2D plane
I need to project 3D nodes (nodes) onto a 2D plane that I got from the code in FEX.
load xyz
fobjPlane=planarFit(xyz);
for i=1:2
subplot(1,2,i);
[hL,hD]=plot(fobjPlane); %Visualize the fit
end
legend([hL,hD],’Plane fit’, ‘XYZ samples’, ‘Location’,’northoutside’,’FontSize’,15);
subplot(1,2,1)
view([-69.5 -24.6])
subplot(1,2,2)
view([9.6 -35.2])
So I need to always get nodes in space however that lie on that plan.I need to project 3D nodes (nodes) onto a 2D plane that I got from the code in FEX.
load xyz
fobjPlane=planarFit(xyz);
for i=1:2
subplot(1,2,i);
[hL,hD]=plot(fobjPlane); %Visualize the fit
end
legend([hL,hD],’Plane fit’, ‘XYZ samples’, ‘Location’,’northoutside’,’FontSize’,15);
subplot(1,2,1)
view([-69.5 -24.6])
subplot(1,2,2)
view([9.6 -35.2])
So I need to always get nodes in space however that lie on that plan. I need to project 3D nodes (nodes) onto a 2D plane that I got from the code in FEX.
load xyz
fobjPlane=planarFit(xyz);
for i=1:2
subplot(1,2,i);
[hL,hD]=plot(fobjPlane); %Visualize the fit
end
legend([hL,hD],’Plane fit’, ‘XYZ samples’, ‘Location’,’northoutside’,’FontSize’,15);
subplot(1,2,1)
view([-69.5 -24.6])
subplot(1,2,2)
view([9.6 -35.2])
So I need to always get nodes in space however that lie on that plan. nodes, projection, orthogonal, plan MATLAB Answers — New Questions
Counting A Column Uniquely Based On Another Column
I have a column (A) which I use check (ü) or false (û) ─ Wingdings font ─ to indicate whether people from column (C) are joined in group or not.
There are duplicates in the column (C), which I write people’s names in, hence there are duplicate checks (ü) or falses (û) in column (A).
I want to count checks (ü) or falses (û) without duplicate, based on column (C); since obviously every checks (ü) or falses (û) would be duplicated multiple times because they have no distinction like names!
I already have a formula for counting column (C) without duplicate which I share below:
=SUM(IF(FREQUENCY(IF(LEN(a2:a497)>0,MATCH(a2:a497,a2:a497,0),””),IF(LEN(a2:a497)>0,MATCH(a2:a497,a2:a497,0),””))>0,1))
I have a column (A) which I use check (ü) or false (û) ─ Wingdings font ─ to indicate whether people from column (C) are joined in group or not.There are duplicates in the column (C), which I write people’s names in, hence there are duplicate checks (ü) or falses (û) in column (A).I want to count checks (ü) or falses (û) without duplicate, based on column (C); since obviously every checks (ü) or falses (û) would be duplicated multiple times because they have no distinction like names!I already have a formula for counting column (C) without duplicate which I share below:=SUM(IF(FREQUENCY(IF(LEN(a2:a497)>0,MATCH(a2:a497,a2:a497,0),””),IF(LEN(a2:a497)>0,MATCH(a2:a497,a2:a497,0),””))>0,1)) Read More
Grouping formula
Hi expert
I would like to create formula as shown in below table.
If I only use IF and AND formula, it will be long and complex formula.
How can I simplified this formula?
From ToWeek28-07-2024 00:00 (Sunday)03-08-2024 23:59 (Saturday)Week 14-08-2024 00:00 (Sunday)10-08-2024 23:59 (Saturday)Week 211-08-2024 00:00 (Sunday)17-08-2024 23:59 (Saturday)Week 3……Week X (Continue till 2025)
Hi expert I would like to create formula as shown in below table.If I only use IF and AND formula, it will be long and complex formula.How can I simplified this formula? From ToWeek28-07-2024 00:00 (Sunday)03-08-2024 23:59 (Saturday)Week 14-08-2024 00:00 (Sunday)10-08-2024 23:59 (Saturday)Week 211-08-2024 00:00 (Sunday)17-08-2024 23:59 (Saturday)Week 3……Week X (Continue till 2025) Read More
Which Matlab product service install for electrical engineering students?
Hi all, hope you are doing well.
Recently I downloded installer of MATLAB and I came to know that there are tons of Mathsworks products.
I am a tteaching faculty in Electrical Engineering. I had installed MATLAB for designing and simulation of Electrical Engineering works and I want to know which products I need to download in my computer for doing my work. Please let me know.
Thank you. Have a great day ahead.Hi all, hope you are doing well.
Recently I downloded installer of MATLAB and I came to know that there are tons of Mathsworks products.
I am a tteaching faculty in Electrical Engineering. I had installed MATLAB for designing and simulation of Electrical Engineering works and I want to know which products I need to download in my computer for doing my work. Please let me know.
Thank you. Have a great day ahead. Hi all, hope you are doing well.
Recently I downloded installer of MATLAB and I came to know that there are tons of Mathsworks products.
I am a tteaching faculty in Electrical Engineering. I had installed MATLAB for designing and simulation of Electrical Engineering works and I want to know which products I need to download in my computer for doing my work. Please let me know.
Thank you. Have a great day ahead. electric_motor_control, power_conversion_control, simpowersystems, power_electronics_control, electric_vehicle MATLAB Answers — New Questions
How to count the number of scatter points of each color
I have make a code that do the scatter points in a graph, but i need to find the number of scatter points of each color? i have attached the sample code and graph for explaintion
for h=num_fixed_nodes+1:1:num_nodes
%Generate random nodes within the region
S1(h).xd = position_region(i,1) + rand(1,1)*region_width;
S1(h).yd = position_region(i,2) + rand(1,1)*region_height;
S1(h).G=0;
S1(h).id=h;
S1(h).type=’N’;
S1(h).temp = interp2(aa1,bb1,temp_values_1,S1(h).xd,S1(h).yd);
S1(h).E=Eo*rand(1,1);
Et=Et+S1(h).E;
S1(h).node_status = S1(h).temp<thresh_temp;
if(S1(h).node_status==1)
scatter(S1(h).xd,S1(h).yd, ‘filled’,’MarkerFaceColor’,’g’);
else
scatter(S1(h).xd,S1(h).yd, ‘filled’,’MarkerFaceColor’,’r’);
end
endI have make a code that do the scatter points in a graph, but i need to find the number of scatter points of each color? i have attached the sample code and graph for explaintion
for h=num_fixed_nodes+1:1:num_nodes
%Generate random nodes within the region
S1(h).xd = position_region(i,1) + rand(1,1)*region_width;
S1(h).yd = position_region(i,2) + rand(1,1)*region_height;
S1(h).G=0;
S1(h).id=h;
S1(h).type=’N’;
S1(h).temp = interp2(aa1,bb1,temp_values_1,S1(h).xd,S1(h).yd);
S1(h).E=Eo*rand(1,1);
Et=Et+S1(h).E;
S1(h).node_status = S1(h).temp<thresh_temp;
if(S1(h).node_status==1)
scatter(S1(h).xd,S1(h).yd, ‘filled’,’MarkerFaceColor’,’g’);
else
scatter(S1(h).xd,S1(h).yd, ‘filled’,’MarkerFaceColor’,’r’);
end
end I have make a code that do the scatter points in a graph, but i need to find the number of scatter points of each color? i have attached the sample code and graph for explaintion
for h=num_fixed_nodes+1:1:num_nodes
%Generate random nodes within the region
S1(h).xd = position_region(i,1) + rand(1,1)*region_width;
S1(h).yd = position_region(i,2) + rand(1,1)*region_height;
S1(h).G=0;
S1(h).id=h;
S1(h).type=’N’;
S1(h).temp = interp2(aa1,bb1,temp_values_1,S1(h).xd,S1(h).yd);
S1(h).E=Eo*rand(1,1);
Et=Et+S1(h).E;
S1(h).node_status = S1(h).temp<thresh_temp;
if(S1(h).node_status==1)
scatter(S1(h).xd,S1(h).yd, ‘filled’,’MarkerFaceColor’,’g’);
else
scatter(S1(h).xd,S1(h).yd, ‘filled’,’MarkerFaceColor’,’r’);
end
end plotting, sum MATLAB Answers — New Questions
Android devices in Device inventory – Microsoft Defender for Endpoint
Hello,
What is the reason or why android mobile devices appear in Device inventory – Microsoft Defender for Endpoint if they are not registered in MS Intune?
In Microsoft Defender Vulnerability Management vulnerabilities related to such devices appear where android needs to be updated to the latest version but there is no information in the device about who uses such phones and they are not in MS Intune
Hello,What is the reason or why android mobile devices appear in Device inventory – Microsoft Defender for Endpoint if they are not registered in MS Intune?In Microsoft Defender Vulnerability Management vulnerabilities related to such devices appear where android needs to be updated to the latest version but there is no information in the device about who uses such phones and they are not in MS Intune Read More
Dynamic 365 for nonprofit.
I have been searching for Dynamic 365 for nonprofit organization that has components of financial management, supply chain management, human resource management, and donors engagement
I have been searching for Dynamic 365 for nonprofit organization that has components of financial management, supply chain management, human resource management, and donors engagement Read More
Changing the atan function so that it ranges from 0 to 2*pi
I know that the matlab atan function returns values in the range of -pi/2 to pi/2. How do i change it so that it goes over the full range 0 to 2*pi?
My first attempt was using a while loop, but it was incorrect.
I need to write a function mfile to set the built-in matlab function atan in the range of 0 to 2*pi *without* using atan2. im new to matlab so im unsure of what to do.
Thank youI know that the matlab atan function returns values in the range of -pi/2 to pi/2. How do i change it so that it goes over the full range 0 to 2*pi?
My first attempt was using a while loop, but it was incorrect.
I need to write a function mfile to set the built-in matlab function atan in the range of 0 to 2*pi *without* using atan2. im new to matlab so im unsure of what to do.
Thank you I know that the matlab atan function returns values in the range of -pi/2 to pi/2. How do i change it so that it goes over the full range 0 to 2*pi?
My first attempt was using a while loop, but it was incorrect.
I need to write a function mfile to set the built-in matlab function atan in the range of 0 to 2*pi *without* using atan2. im new to matlab so im unsure of what to do.
Thank you function, range, live script MATLAB Answers — New Questions
Command to open task manager summary view
Is there a command that will open task manager in summary view? I was to automate a script that will start task manager in summary view whenever I start my PC so I can monitor my performance. I know there are other apps out there that can monitor performance but I like the graph and simple gui that task manager has.
Unless anyone knows a app that has visuals like that 🙂
Is there a command that will open task manager in summary view? I was to automate a script that will start task manager in summary view whenever I start my PC so I can monitor my performance. I know there are other apps out there that can monitor performance but I like the graph and simple gui that task manager has. Unless anyone knows a app that has visuals like that 🙂 Read More
to get only the marked cells in a row.
in one row i have multiple products name (40 products). But i out of 40 i would have marked only few of them.
I need only that marked products to display in another sheet.
can someone help me here.
in one row i have multiple products name (40 products). But i out of 40 i would have marked only few of them.I need only that marked products to display in another sheet.can someone help me here. Read More
Python library for probabilistic graphical model(PGM)?
I want to use some python library to create a PGM for joint-distribution modeling and probabilistic inference. To be more specific, I have a time series data, which consists of many time slices. There are multiple variables in each time slices. Some of the variables are discrete, others are continuous. I want to do structure learning and parameter learning with this data and finally create a PGM. But I couldn’t find any suitable python library for that.
I found a library named PyPGM,
But it seems that it doesn’t support time series and hybrid(discrete and continuous)I want to use some python library to create a PGM for joint-distribution modeling and probabilistic inference. To be more specific, I have a time series data, which consists of many time slices. There are multiple variables in each time slices. Some of the variables are discrete, others are continuous. I want to do structure learning and parameter learning with this data and finally create a PGM. But I couldn’t find any suitable python library for that.
I found a library named PyPGM,
But it seems that it doesn’t support time series and hybrid(discrete and continuous) I want to use some python library to create a PGM for joint-distribution modeling and probabilistic inference. To be more specific, I have a time series data, which consists of many time slices. There are multiple variables in each time slices. Some of the variables are discrete, others are continuous. I want to do structure learning and parameter learning with this data and finally create a PGM. But I couldn’t find any suitable python library for that.
I found a library named PyPGM,
But it seems that it doesn’t support time series and hybrid(discrete and continuous) python MATLAB Answers — New Questions
Attempt to plot an piecewise function
I am trying to implemment an algorithm for Rayleigh-Ritz method using B-Spline basis ( see Burden, numerical analysis, 9th ed. section 11.5). The fuction S is the following:
my attempt is:
S = @(x) ( (x <= -2) ) .* 0 + …
( (x > -2) & (x <= -1) ) .* (1/4 * (2 + x).^3) + …
( (x > -1) & (x <= 0) ) .* (1/4 * (2 + x).^3 – 4 * (1 + x).^3) + …
( (x > 0) & (x <= 1) ) .* (1/4 * (2 – x).^3 – 4 * (1 – x).^3) + …
( (x > 1) & (x <= 2) ) .* (1/4 * (2 – x).^3) + …
( (x > 2) ) .* 0;
% Plotting the function
y_v = linspace(-3, 3, 100); % Extend the range a bit to see behavior around boundaries
s_valores = arrayfun(S, y_v);
plot(y_v, s_valores);
xlabel(‘x’);
ylabel(‘S(x)’);
title(‘Piecewise Function S(x)’);
grid on;
I was expecting the graph to be like
I run it in Octave, but it is very similar to Matlab. Can you point what I am missing?I am trying to implemment an algorithm for Rayleigh-Ritz method using B-Spline basis ( see Burden, numerical analysis, 9th ed. section 11.5). The fuction S is the following:
my attempt is:
S = @(x) ( (x <= -2) ) .* 0 + …
( (x > -2) & (x <= -1) ) .* (1/4 * (2 + x).^3) + …
( (x > -1) & (x <= 0) ) .* (1/4 * (2 + x).^3 – 4 * (1 + x).^3) + …
( (x > 0) & (x <= 1) ) .* (1/4 * (2 – x).^3 – 4 * (1 – x).^3) + …
( (x > 1) & (x <= 2) ) .* (1/4 * (2 – x).^3) + …
( (x > 2) ) .* 0;
% Plotting the function
y_v = linspace(-3, 3, 100); % Extend the range a bit to see behavior around boundaries
s_valores = arrayfun(S, y_v);
plot(y_v, s_valores);
xlabel(‘x’);
ylabel(‘S(x)’);
title(‘Piecewise Function S(x)’);
grid on;
I was expecting the graph to be like
I run it in Octave, but it is very similar to Matlab. Can you point what I am missing? I am trying to implemment an algorithm for Rayleigh-Ritz method using B-Spline basis ( see Burden, numerical analysis, 9th ed. section 11.5). The fuction S is the following:
my attempt is:
S = @(x) ( (x <= -2) ) .* 0 + …
( (x > -2) & (x <= -1) ) .* (1/4 * (2 + x).^3) + …
( (x > -1) & (x <= 0) ) .* (1/4 * (2 + x).^3 – 4 * (1 + x).^3) + …
( (x > 0) & (x <= 1) ) .* (1/4 * (2 – x).^3 – 4 * (1 – x).^3) + …
( (x > 1) & (x <= 2) ) .* (1/4 * (2 – x).^3) + …
( (x > 2) ) .* 0;
% Plotting the function
y_v = linspace(-3, 3, 100); % Extend the range a bit to see behavior around boundaries
s_valores = arrayfun(S, y_v);
plot(y_v, s_valores);
xlabel(‘x’);
ylabel(‘S(x)’);
title(‘Piecewise Function S(x)’);
grid on;
I was expecting the graph to be like
I run it in Octave, but it is very similar to Matlab. Can you point what I am missing? plot, plotting MATLAB Answers — New Questions
HELP! Error using plot Vectors must be the same length. Error in Doc (line 94) plot(t, y);
Hello everyone!! I’m trying to plot: x,y,X,Y. But when my matlab try to plot y, the following error appears: Error using plot Vectors must be the same length. Error in doc (lne 94) plot(t, y);
Please fell free to check the code below:
Fs = 5000;
T = 1/Fs;
t = 0:T:1-T;
NFFT = 2^nextpow2(length(t));
x = cos(2*pi*100*t) + cos(2*pi*500*t) + cos(2*pi*1000*t);
[X, f, ~] = fftm(x, Fs, NFFT);
H = double(f <= 600);
Y = X .* H;
y = ifft(Y);
figure;
subplot(2,1,1);
plot(t, x);
title(‘x(t)’);
xlabel(‘Time(s)’);
ylabel(‘Amp’);
subplot(2,1,2);
plot(t, y);
title(‘y(t)’);
xlabel(‘Time(s)’);
ylabel(‘Amp’);
figure;
subplot(2,1,1);
plot(f, abs(X));
title(‘X(omega)’);
xlabel(‘Freq(Hz)’);
ylabel(‘Mag’);
subplot(2,1,2);
plot(f, abs(Y));
title(‘Y(omega)’);
xlabel(‘Freq(Hz)’);
ylabel(‘Mag’);
Oh, the following function fftm in line 6, is a function downloaded by me, it’s a fft function modified, and you can see it below:
% Modified fft algorithm
%
% This function estimates the fft of a signal x using the Fs sampling
% frequency, NFFT bins, and returns the frequencies values along with the spectrum X.
%
% [X,f] = fftm(x,Fs,NFFT)
%
% Example:
% Fs = 1e3;
% t = 0:0.001:1-0.001;
% x = cos(2*pi*100*t)+sin(2*pi*202.5*t);
% [X,f]=fftm(x,Fs,2000);
% plot(f,abs(X));
% http://www.mathworks.com/help/signal/ug/amplitude-estimation-and-zero-padding.html
% http://www.mathworks.com/help/signal/ug/psd-estimate-using-fft.html
function [xdft,f, psdx] = fftm(x,Fs,NFFT)
L = length(x);
if nargin < 3
NFFT = 2^nextpow2(L);
end
xdft = fft(x,NFFT);
xdft = xdft(1:length(xdft)/2+1);
psdx = (1/(Fs*L)).*abs(xdft).^2;
psdx(2:end-1) = 2*psdx(2:end-1);
psdx = 10*log10(psdx);
xdft = 1/L.*xdft;
xdft(2:end-1) = 2*xdft(2:end-1);
f = 0:Fs/NFFT:Fs/2;Hello everyone!! I’m trying to plot: x,y,X,Y. But when my matlab try to plot y, the following error appears: Error using plot Vectors must be the same length. Error in doc (lne 94) plot(t, y);
Please fell free to check the code below:
Fs = 5000;
T = 1/Fs;
t = 0:T:1-T;
NFFT = 2^nextpow2(length(t));
x = cos(2*pi*100*t) + cos(2*pi*500*t) + cos(2*pi*1000*t);
[X, f, ~] = fftm(x, Fs, NFFT);
H = double(f <= 600);
Y = X .* H;
y = ifft(Y);
figure;
subplot(2,1,1);
plot(t, x);
title(‘x(t)’);
xlabel(‘Time(s)’);
ylabel(‘Amp’);
subplot(2,1,2);
plot(t, y);
title(‘y(t)’);
xlabel(‘Time(s)’);
ylabel(‘Amp’);
figure;
subplot(2,1,1);
plot(f, abs(X));
title(‘X(omega)’);
xlabel(‘Freq(Hz)’);
ylabel(‘Mag’);
subplot(2,1,2);
plot(f, abs(Y));
title(‘Y(omega)’);
xlabel(‘Freq(Hz)’);
ylabel(‘Mag’);
Oh, the following function fftm in line 6, is a function downloaded by me, it’s a fft function modified, and you can see it below:
% Modified fft algorithm
%
% This function estimates the fft of a signal x using the Fs sampling
% frequency, NFFT bins, and returns the frequencies values along with the spectrum X.
%
% [X,f] = fftm(x,Fs,NFFT)
%
% Example:
% Fs = 1e3;
% t = 0:0.001:1-0.001;
% x = cos(2*pi*100*t)+sin(2*pi*202.5*t);
% [X,f]=fftm(x,Fs,2000);
% plot(f,abs(X));
% http://www.mathworks.com/help/signal/ug/amplitude-estimation-and-zero-padding.html
% http://www.mathworks.com/help/signal/ug/psd-estimate-using-fft.html
function [xdft,f, psdx] = fftm(x,Fs,NFFT)
L = length(x);
if nargin < 3
NFFT = 2^nextpow2(L);
end
xdft = fft(x,NFFT);
xdft = xdft(1:length(xdft)/2+1);
psdx = (1/(Fs*L)).*abs(xdft).^2;
psdx(2:end-1) = 2*psdx(2:end-1);
psdx = 10*log10(psdx);
xdft = 1/L.*xdft;
xdft(2:end-1) = 2*xdft(2:end-1);
f = 0:Fs/NFFT:Fs/2; Hello everyone!! I’m trying to plot: x,y,X,Y. But when my matlab try to plot y, the following error appears: Error using plot Vectors must be the same length. Error in doc (lne 94) plot(t, y);
Please fell free to check the code below:
Fs = 5000;
T = 1/Fs;
t = 0:T:1-T;
NFFT = 2^nextpow2(length(t));
x = cos(2*pi*100*t) + cos(2*pi*500*t) + cos(2*pi*1000*t);
[X, f, ~] = fftm(x, Fs, NFFT);
H = double(f <= 600);
Y = X .* H;
y = ifft(Y);
figure;
subplot(2,1,1);
plot(t, x);
title(‘x(t)’);
xlabel(‘Time(s)’);
ylabel(‘Amp’);
subplot(2,1,2);
plot(t, y);
title(‘y(t)’);
xlabel(‘Time(s)’);
ylabel(‘Amp’);
figure;
subplot(2,1,1);
plot(f, abs(X));
title(‘X(omega)’);
xlabel(‘Freq(Hz)’);
ylabel(‘Mag’);
subplot(2,1,2);
plot(f, abs(Y));
title(‘Y(omega)’);
xlabel(‘Freq(Hz)’);
ylabel(‘Mag’);
Oh, the following function fftm in line 6, is a function downloaded by me, it’s a fft function modified, and you can see it below:
% Modified fft algorithm
%
% This function estimates the fft of a signal x using the Fs sampling
% frequency, NFFT bins, and returns the frequencies values along with the spectrum X.
%
% [X,f] = fftm(x,Fs,NFFT)
%
% Example:
% Fs = 1e3;
% t = 0:0.001:1-0.001;
% x = cos(2*pi*100*t)+sin(2*pi*202.5*t);
% [X,f]=fftm(x,Fs,2000);
% plot(f,abs(X));
% http://www.mathworks.com/help/signal/ug/amplitude-estimation-and-zero-padding.html
% http://www.mathworks.com/help/signal/ug/psd-estimate-using-fft.html
function [xdft,f, psdx] = fftm(x,Fs,NFFT)
L = length(x);
if nargin < 3
NFFT = 2^nextpow2(L);
end
xdft = fft(x,NFFT);
xdft = xdft(1:length(xdft)/2+1);
psdx = (1/(Fs*L)).*abs(xdft).^2;
psdx(2:end-1) = 2*psdx(2:end-1);
psdx = 10*log10(psdx);
xdft = 1/L.*xdft;
xdft(2:end-1) = 2*xdft(2:end-1);
f = 0:Fs/NFFT:Fs/2; vector, vectors must be the same length, error, matlab, vectors error, plot, plot error, fourier MATLAB Answers — New Questions