need solution during trainning

83 ビュー (過去 30 日間)
NABARUN MAIKAP
NABARUN MAIKAP 2020 年 5 月 11 日
回答済み: Muthulakshmi 2022 年 10 月 22 日
この 質問 は Walter Roberson さんによってフラグが設定されました
Hello all, I am new in this community .I need help to solve the below problem. please help me..
statement : You can add a custom function at the end of your script. For data preprocessing, the function should take the data returned from the datastore as input. It should return the transformed data as output.
function dataout = functionName(datain)
% do something with datain
dataout = ...
end
Given script :
letterds = datastore("*_M_*.txt");
data = read(letterds);
data = scale(data);
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
Task ; -
Create a function called scale at the end of the script that performs the following operations:
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
Because these commands modify the variable data directly, your function should use data as both the input and output variable.
Note that the third line of the script calls the scale function. Your script won't run until this function has been created.
Also note that local functions must be at the end of a script. This means you will be editing the script sections out of order in this interaction. The section headings show which section of the script to edit in each task.
  4 件のコメント
Rhonnel S. Paculanan
Rhonnel S. Paculanan 2022 年 6 月 8 日
TASK 1
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
end
TASK 2
preprocds =transform( letterds , @scale ) % directly process the data storage
% Read all processed data
data =readall( preprocds );
plot( data . Time , data . Y )
TASK 3
preprocds = transform(letterds,@scale)
data = readall(preprocds)
plot(data.Time,data.Y)
TASK 4 (erase the content of Tasks 1 and paste this program)
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
data.X = data.X - mean(data.X);
data.Y = data.Y - mean(data.Y);
end
TASK 5 (erase the content of Tasks 4 and paste this program)
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
data.X = data.X - mean(data.X,"omitnan");
data.Y = data.Y - mean(data.Y,"omitnan");
end

サインインしてコメントする。

回答 (12 件)

Ravi kumar
Ravi kumar 2020 年 5 月 13 日
letterds = datastore("*_M_*.txt");
data = read(letterds);
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
data = scale(data);
  2 件のコメント
Rhonnel S. Paculanan
Rhonnel S. Paculanan 2022 年 6 月 8 日
TASK 1
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
end
TASK 2
preprocds =transform( letterds , @scale ) % directly process the data storage
% Read all processed data
data =readall( preprocds );
plot( data . Time , data . Y )
TASK 3
preprocds = transform(letterds,@scale)
data = readall(preprocds)
plot(data.Time,data.Y)
TASK 4 (erase the content of Tasks 1 and paste this program)
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
data.X = data.X - mean(data.X);
data.Y = data.Y - mean(data.Y);
end
TASK 5 (erase the content of Tasks 4 and paste this program)
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
data.X = data.X - mean(data.X,"omitnan");
data.Y = data.Y - mean(data.Y,"omitnan");
end

サインインしてコメントする。


VISHAL
VISHAL 2020 年 5 月 30 日
letterds = datastore("*_M_*.txt");
data = read(letterds);
data = scale(data);
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
end
  2 件のコメント
Rhonnel S. Paculanan
Rhonnel S. Paculanan 2022 年 6 月 8 日
TASK 1
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
end
TASK 2
preprocds =transform( letterds , @scale ) % directly process the data storage
% Read all processed data
data =readall( preprocds );
plot( data . Time , data . Y )
TASK 3
preprocds = transform(letterds,@scale)
data = readall(preprocds)
plot(data.Time,data.Y)
TASK 4 (erase the content of Tasks 1 and paste this program)
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
data.X = data.X - mean(data.X);
data.Y = data.Y - mean(data.Y);
end
TASK 5 (erase the content of Tasks 4 and paste this program)
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
data.X = data.X - mean(data.X,"omitnan");
data.Y = data.Y - mean(data.Y,"omitnan");
end

サインインしてコメントする。


Hessel
Hessel 2020 年 6 月 1 日
you should put the "sacle" function at the end
letterds = datastore("*_M_*.txt");
data = read(letterds);
data = scale(data);
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
preprocds = transform(letterds,@scale)
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
end
  1 件のコメント
BRAJ KISHOR VERMA
BRAJ KISHOR VERMA 2020 年 6 月 2 日
show wrong result

サインインしてコメントする。


Ali Al-nuaimi
Ali Al-nuaimi 2020 年 6 月 12 日
preprocds = transform(letterds,@scale)
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
end
  2 件のコメント
Prayas
Prayas 2022 年 9 月 15 日
answer is wrong sir please solve it

サインインしてコメントする。


L.J.
L.J. 2020 年 6 月 13 日
data = readall(preprocds);
plot(data.Time, data.Y)
The first line of code needs to be surpressed, so just be sure to add a ; to solve the issue :) good luck
  2 件のコメント
구룽
구룽 2022 年 10 月 2 日
task 2 says it's incorrect :(

サインインしてコメントする。


Roshan karthick
Roshan karthick 2020 年 5 月 13 日
letterds = datastore("*_M_*.txt");
data = read(letterds);
data = scale(data);
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
  2 件のコメント
Gulfairuz Baiturganova
Gulfairuz Baiturganova 2021 年 12 月 13 日
Do you know what is the right answer for the task 2?

サインインしてコメントする。


BRAJ KISHOR VERMA
BRAJ KISHOR VERMA 2020 年 5 月 28 日
編集済み: Walter Roberson 2020 年 6 月 15 日
letterds = datastore("*_M_*.txt");
preprocds = transform(letterds,@scale)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
data = scale(data);
in this we have a task
TASK
Use the readall function to import all the data. Check that the preprocessing function was applied to each file by plotting the Y variable as a function of Time.

Priti Gujar
Priti Gujar 2020 年 6 月 15 日
Use the transform function to create a transformed datastore called preprocds. This datastore should apply the scale function to the data referenced by letterds.

Abdul Aziz Hisham Shubbak
Abdul Aziz Hisham Shubbak 2021 年 4 月 19 日
last all ::
function data = scale(data)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
data.X = data.X - mean(data.X);
data.Y = data.Y - mean(data.Y);
end

Nakshathra
Nakshathra 2022 年 9 月 29 日
letterds = datastore("*_M_*.txt");
preprocds = transform(letterds,@scale)
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
plot(data.X,data.Y)
axis equal
plot(data.Time,data.Y)
ylabel("Vertical position")
xlabel("Time")
data = scale(data);preprocds = transform(letterds,@scale)data.Time = (data.Time - data.Time(1))/1000;data.X = 1.5*data.X;plot(data.X,data.Y)axis equalplot(data.Time,data.Y)ylabel("Vertical position")xlabel("Time")data = scale(data);

R Balaganesh
R Balaganesh 2022 年 10 月 8 日
Create a function called scale at the end of the script that performs the following operations:
data.Time = (data.Time - data.Time(1))/1000;
data.X = 1.5*data.X;
Because these commands modify the variable data directly, your function should use data as both the input and output variable.
Note that the third line of the script calls the scale function. Your script won't run until this function has been created.
Also note that local functions must be at the end of a script. This means you will be editing the script sections out of order in this interaction. The section headings show which section of the script to edit in each task.

Muthulakshmi
Muthulakshmi 2022 年 10 月 22 日
At the end of the script, add a local function called extract that takes a single variable, letter, as input and returns a table of features, feat, as output. Copy the code from the beginning of the script and from task 2 to make the body of the function. Test your function by calling it with b2 as input. Store the result in a variable called featB2

カテゴリ

Find more on Large Files and Big Data in Help Center and File Exchange

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by